Git Product home page Git Product logo

sql-create-tables-lab's Introduction

Sql Create Tables Lab

Building off of what we've learned about creating tables and column types, let's play around with writing SQL CREATE statements.

Learning Objectives

  1. Learn to write SQL CREATE statements
  2. Learn about the different column types supported in SQL and SQLite3

About this Lab

Let's take a look at this lab's structure, which will seem slightly different than what you've been working with before.

├── Gemfile
├── README.md
├── bin
│   ├── environment.rb # requires bundler and files
│   ├── run.rb # instantiates the SQLRunner class in the below file
│   └── sql_runner.rb # holds a class that handles executing your .sql files
├── lib
│   ├── create.sql # where you create your schema
└── spec # all the specs
    ├── create_spec.rb # this tests your create_table.sql file
    └── spec_helper.rb

The way SQL labs work is that you'll write your SQL statements in .sql files in the lib/ directory, and the run.rb file in bin/ will execute them using the sql_runner.rb class. When you run the tests, the SQLRunner class is called and a new database is created in memory for the tests.

Todo

Create a table called cats with the following columns and types:

column type
id primary key
name text
age integer
gender char(1)(The choices would be "M" or "F")
breed text
temperament text
declawed boolean

View Sql Create Tables Lab on Learn.co and start learning to code for free.

sql-create-tables-lab's People

Contributors

ahimmelstoss avatar annjohn avatar changamanda avatar fislabstest avatar fs-lms-test-bot avatar joshuabamboo avatar octosteve avatar sarogers avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sql-create-tables-lab's Issues

Perhaps intentional, confusing nonetheless

In the table at the bottom of the readme some of the types are not supported by sqlite3. The docs for sqlite3 say you can't limit the amount of characters in a TEXT type (see gender). Also, boolean values are only represented in the INTEGER type.

While this is easy to figure out by reading through the data types on the docs, perhaps a hint is needed to do this research?

If your thinking "no, the student should be discovering how they need to do research on their own" then I would argue that in the previous lab it tells us not to worry about the other datatypes yet and to just keep going. Sort of insinuating to not get distracted by the docs...

SQLRunner is difficult to debug

Dynamically created methods aren't really necessary here, and our execute method is basically rewriting SQLite3::Database#execute_batch

spelling error

"temperment" should be temperament, all through the lab and readme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.