SQL Objects#

  • SQL table
  • views
  • stored procedures
  • functions

A query is a command you write in SQL with the idea of either retrieving information from the database on which you are working, or, alternatively, to insert, update, or delete data from it.


Constraints are specific rules, or limits, that we define in our tables.

Primary Key#

Foreign Key#

Foreign Key points to a column of another table and, thus, links the two tables. columns' name don't have to be the same.

child table/referencing table parent table/referenced table

ON DELETE CASCADE delete records in child table if corresponding record is deleted in parent table.

Unique Key#

Unique keys in MySQL have the same role as indexes. The reverse isn't true.

Index of a table is an organizational unit that helps retrieve data more easily.

Creating and updating index takes time.

Primary Key couldn't have NULL values. Unique Key may have.



Clean Code#