Code Monkey home page Code Monkey logo

python-p3-conclusion-to-sql-table-relations's Introduction

Conclusion to Table Relations in SQL

Learning Goals

  • Use primary and foreign keys to create the relations in a relational database.
  • Use INNER JOIN and LEFT JOIN to retrieve relevant data for members of one table in other tables.
  • Use joins to create one-to-many and many-to-many relationships between tables.

Key Vocab

  • Primary Key: a number that uniquely identifies one record in a table.
  • Foreign Key: a column or group of columns that connects one table to another.
  • Join: a query that returns related records from multiple tables in a single record.
  • One-to-Many: a type of relationship between tables where one record in table A is connected to multiple records in table B. e.g. One person ordering multiple drinks at a bar.
  • Many-to-Many: a type of relationship between tables where multiple records in table A are connected to multiple records in table B. e.g. Students have many classes and classes have many students.

Conclusion

We've established that SQL is a useful programming language to know, and that the majority of databases you'll work with will have more than one table. As demonstrated in this section, we've been able to learn and apply concepts that connect together these tables in various ways. These table relationships are important to illustrate real-world data.

In this section we covered:

  • The structure of a relational database as tables
  • How to associate data tables using a foreign key column
  • Different types of joins
  • Relationship types, such as "one-to-many" and "many-to-many"

We can now distinguish the different types of relationships between data in a database, and use SQL to query data across multiple tables.

With the ability to define relationships between different tables we can model data that is more accurate to the real world!


Resources

python-p3-conclusion-to-sql-table-relations's People

Contributors

professor-ben avatar

Watchers

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

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.