Coder Social home page Coder Social logo

sql-table-relations-readme's Issues

Change from pets table to cats table

Step 2: Creating the Owners Table
First, we need to create our owners table. An owner should have an ID that is a primary key integer and a name that is text:

CREATE TABLE owners (id INTEGER PRIMARY KEY, name TEXT);
Now that we have our owners table, we can add a foreign key column to the pets table.


Error: Last sentence should read "foreign key column to the cats table".
The tables that were created were cats and owners. There is no 'pets table' for this example.

"Tables" Not "Rows"

Hi this should read "tables" not "rows".
I'd written out diagrams over and over and over and couldn't figure out how 'rows' for Author and Post would be plausible.

Line # 7 : change 'rows" to "tables" . "figure out how to related two rows ( a Post and an Author) using only...."
*********Relating Tables with Foreign Keys
Continuing the posts and authors examples, you could say that an author has many posts. The reciprocal of this would be that a post belongs to an author. Now we need to figure out how we can represent that relationship within the constraints of SQLite. If you were writing just plain ruby, how would you represent this relationship? In our Author class we would have an array of Post objects. Our Post object would have a single attribute that holds its Author. This is great in Ruby, but there is no data type for arrays in SQL. You can only have INTEGER, FLOAT, and TEXT. So developers had to figure out how to relate two rows (a Post and an Author) using only those data types. Is there any way we can convert an INTEGER into a specific row in a table? OH YEAH.

Small Typo: "R"uby

Capitalize Ruby in last line below.


Relating Tables with Foreign Keys
Continuing the posts and authors examples, you could say that an author has many posts. The reciprocal of this would be that a post belongs to an author. Now we need to figure out how we can represent that relationship within the constraints of SQLite. If you were writing just plain ruby, how

Learn Suggestion

This isn't lesson specific, but it occurred to me how helpful it would be if there were a central html file or git repository with all the external resource links organized by topic. I would love to be able to go in a grab them all into bookmarks folders to save for future use, yet I find within the workflow of learn, my focus is on completing lessons and not exploring them as much, so I sometimes skip over them.

Just a thought

MC

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.