You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-12Lines changed: 28 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# SQL Bear Organizer
2
2
3
-
[Timothy Treadwell](http://en.wikipedia.org/wiki/Timothy_Treadwell) has a lot on his plate protecting the bears of the Katmai National Park in Alaska. Help him keep track of all of his bear friends using SQL.
3
+
[Timothy Treadwell](http://en.wikipedia.org/wiki/Timothy_Treadwell) has a lot on
4
+
his plate protecting the bears of the Katmai National Park in Alaska. Help him
This lab might seem a bit different than what you've seen before. Take a look at the file structure:
17
+
This lab might seem a bit different than what you've seen before. Take a look at
18
+
the file structure:
16
19
17
20
```bash
18
21
├── Gemfile
@@ -44,15 +47,22 @@ before do
44
47
@sql_runner.execute_create_file
45
48
end
46
49
```
50
+
47
51
Before each test two important things happen.
48
52
49
-
First, a new in-memory database is created. Why do we do this? Let's say we run our tests and they add ten items to our database. If we did not use an in-memory store, those would be in there forever. This way our database gets thrown out after every running of the tests. You can learn more about in-memory databases [here](https://www.sqlite.org/inmemorydb.html).
53
+
First, a new in-memory database is created. Why do we do this? Let's say we run
54
+
our tests and they add ten items to our database. If we did not use an in-memory
55
+
store, those would be in there forever. This way our database gets thrown out
56
+
after every running of the tests. You can learn more about in-memory databases
57
+
[here](https://www.sqlite.org/inmemorydb.html).
50
58
51
-
Next, a new `SqlRunner` class is created. The `SqlRunner` class lives in your `bin` directory and was created to help connect to the database.
59
+
Next, a new `SqlRunner` class is created. The `SqlRunner` class lives in your
60
+
`bin` directory and was created to help connect to the database.
52
61
53
62
## Part 1: `CREATE TABLE`
54
63
55
-
Get the tests in `spec/create_spec.rb` to pass. Your `CREATE` statement should look something like this:
64
+
Get the tests in `spec/create_spec.rb` to pass. Your `CREATE` statement should
65
+
look something like this:
56
66
57
67
```sql
58
68
CREATETABLEbears (
@@ -98,11 +108,14 @@ Your columns should be the following types:
98
108
</tr>
99
109
</table>
100
110
101
-
Read about [SQLite3 Datatypes](https://www.sqlite.org/datatype3.html) to determine what your insert values are going to be. Be sure to pay attention to how booleans are expressed in SQLite3.
111
+
Read about [SQLite3 Datatypes](https://www.sqlite.org/datatype3.html) to
112
+
determine what your insert values are going to be. Be sure to pay attention to
113
+
how booleans are expressed in SQLite3.
102
114
103
115
## Part 2: `INSERT`
104
116
105
-
Get the tests in `spec/insert_spec.rb` to pass. Input the following 8 bears (you can make up details about them, but make sex either 'M' or 'F'):
117
+
Get the tests in `spec/insert_spec.rb` to pass. Input the following 8 bears (you
118
+
can make up details about them, but make sex either 'M' or 'F'):
106
119
107
120
* Mr. Chocolate
108
121
* Rowdy
@@ -111,17 +124,20 @@ Get the tests in `spec/insert_spec.rb` to pass. Input the following 8 bears (you
111
124
* Melissa
112
125
* Grinch
113
126
* Wendy
114
-
* unnamed (the bear that killed Tim didn't have a name; refer back to how to create a record that doesn't have one value)
127
+
* unnamed (the bear that killed Tim didn't have a name; refer back to how to
128
+
create a record that doesn't have one value)
115
129
116
130
## Part 3: `SELECT`
117
131
118
-
Get the tests in `spec/select_spec.rb` to pass. Note that for this section, the database will be seeded with external data from the `lib/seed.sql` file so don't expect it to reflect the data you added above. Note: Since it's a Ruby file, write your queries as strings in the `lib/sql_queries.rb`.
132
+
Get the tests in `spec/select_spec.rb` to pass. Note that for this section, the
133
+
database will be seeded with external data from the `lib/seed.sql` file so don't
134
+
expect it to reflect the data you added above. Note: Since it's a Ruby file,
135
+
write your queries as strings in the `lib/sql_queries.rb`.
119
136
120
-
You may be expected to use SQL statements that you're not particularly familiar with. Make sure you use the resources and Google to find the right statements.
137
+
You may be expected to use SQL statements that you're not particularly familiar
138
+
with. Make sure you use the resources and Google to find the right statements.
0 commit comments