{"id":15472872,"url":"https://github.com/hackvan/sql-bear-organizer","last_synced_at":"2026-06-13T13:34:30.593Z","repository":{"id":145341903,"uuid":"142617822","full_name":"hackvan/SQL-bear-organizer","owner":"hackvan","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-27T19:49:51.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-05T17:13:23.892Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hackvan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-27T19:49:03.000Z","updated_at":"2018-07-27T19:49:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"df3566f6-3360-480f-92e5-9b2e79a8c054","html_url":"https://github.com/hackvan/SQL-bear-organizer","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"a18b74e506395a585d0f15d5789f63150223f4a9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackvan%2FSQL-bear-organizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackvan%2FSQL-bear-organizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackvan%2FSQL-bear-organizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackvan%2FSQL-bear-organizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hackvan","download_url":"https://codeload.github.com/hackvan/SQL-bear-organizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240386530,"owners_count":19793193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T02:41:29.539Z","updated_at":"2026-06-13T13:34:25.568Z","avatar_url":"https://github.com/hackvan.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL Bear Organizer\n\n[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.\n\n![timothy-treadwell](http://m2.paperblog.com/i/74/746121/lagghiacciante-morte-delluomo-grizzly-sbranat-L-rr7aep.jpeg)\n\n## Objectives\n\n1. Use the `CREATE TABLE` command to create a new table with various data types\n2. Use the `INSERT INTO` command to insert data (i.e. rows) into a database table\n3. Use the `SELECT` command with various functions and modifiers to write queries\n\n## Lab Structure\n\nThis lab might seem a bit different than what you've seen before. Take a look at the file structure:\n\n```bash\n├── Gemfile\n├── README.md\n├── bin\n│   ├── environment.rb # requires bundler and files\n│   ├── run.rb # instantiates the SQLRunner class in the below file\n│   └── sql_runner.rb # holds a class that handles executing your .sql files\n├── lib\n│   ├── create.sql # where you create your schema\n│   └── insert.sql # where you insert your data\n│   └── seed.sql # data for in-memory database\n│   └── sql_queries.rb # where you write your sql queries\n└── spec # all the specs\n    ├── create_spec.rb # this tests your create.sql file\n    ├── insert_spec.rb # this tests your insert.sql file\n    ├── select_spec.rb # this tests the queries you write in this file\n    └── spec_helper.rb\n```\n\n### A Note on Testing\n\nLet's briefly go over what is happening in the `before` block that our tests will be using.\n\n```ruby\nbefore do\n  @db = SQLite3::Database.new(':memory:')\n  @sql_runner = SQLRunner.new(@db)\n  @sql_runner.execute_create_file\nend\n```\nBefore each test two important things happen.\n\nFirst, 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).\n\nNext, a new `SqlRunner` class is created. The `SqlRunner` class lives in your `bin` directory and was created to help connect to the database.\n\n## Part 1: `CREATE TABLE`\n\nGet the tests in `spec/create_spec.rb` to pass. Your `CREATE` statement should look something like this:\n\n```sql\nCREATE TABLE bears (\n  //columns here\n);\n```\n\nYour columns should be the following types:\n\n|column | type  |\n|-------|-------|\n|id     |integer| \u003c-- Make sure this is the table's primary key\n|name   |text   |\n|age    |integer|\n|gender |char(1)(The choices would be \"M\" or \"F\")|\n|color  |text   |\n|temperament|text|\n|alive  |boolean|\n\nRead 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.\n\n## Part 2: `INSERT`\n\nGet the tests in `spec/insert_spec.rb` to pass. Input the following 8 bears (you can make up details about them):\n\n* Mr. Chocolate\n* Rowdy\n* Tabitha\n* Sergeant Brown\n* Melissa\n* Grinch\n* Wendy\n* 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)\n\n## Part 3: `SELECT`\n\nGet 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`.\n\nYou 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.\n\n## Resources\n\n[SQL Datatypes](https://www.sqlite.org/datatype3.html)\n[SQL GROUP BY](https://www.sqlite.org/lang_select.html#resultset)\n\n\u003cp data-visibility='hidden'\u003eView \u003ca href='https://learn.co/lessons/SQL-bear-organizer-lab' title='SQL Bear Organizer'\u003eSQL Bear Organizer\u003c/a\u003e on Learn.co and start learning to code for free.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackvan%2Fsql-bear-organizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhackvan%2Fsql-bear-organizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackvan%2Fsql-bear-organizer/lists"}