A database is a container that holds tables and other SQl structures related to those tables.
The information inside the database in organized into tables.
Tables are organized as columns and rows.
Column = Value (Last name)
Row = Information (Hackman)
This is all about setting up queries and making info searchable.
CREATE TABLE in all caps table_name lowercase.
(last_name VARCHAR (variable character) (up to 30 characters long).
email VARCHAR (50),
birthday DATE,
profession VARCHAR (50),
* commant tells RDBMS to give back values from all the columns in the table.
VARCHAR, CHAR, BLOB, DATE and TIME data types need single quotes. The numerical types, DEC and INT don’t.
Operators to use :
IS NULL: Use this to create a condition to test for NULL value.
AND and OR: With AND and OR, you can combine you condistional statements in your WHERE clauses for more precision.
NOT: NOT lets you negate your results and get the opposite values.
DELETE: This is the tool fo deleting rows of data from the table. Use it with a WHERE clause to precisely pinpoint the rows you want to remove.
UPDATE: Updates an existing column or columns with a new value. It also uses a WHERE clause.
SET: This keyword belongs in an UPDATE statement and is used to change the value of an existing column.
ATOMIC DATA: Data in your columns is atomic if it’s been broken down into the smallest pieces that you need.
Atomic Data Rule 1: It can’t have the same data in the same column.
Atomic Data Rule 2: can’t have multiple columns with the same type of data.
SHOW CREATE TABLE: command to see the correct syntax for creating an existing table.
FIRST NORMAL FORM (1NF): Each row of data must contain atomic values, and each row of data must have a unique identifier.
PRIMARY KEY: A column or set of columns that uniquely identifies a row of data in a table.
AUTO_INCREMENT: When used in your column declaration, that column will automatically be given a unique interger value each time an INSERT is performed.
Transitive functional dependency: This means any non-key column is related to any of the other non-key columns.
Schema: A description of the data in your database.
One-to-one relationship: Exactly one row of a parent table is related to one row of a child table.
One-to-many relationship: Two tables are connected by a junction table, allowing many rows in the first to match many rows in the second, and vice versa.
Second Normal Form (2NF): Your table must be in INF and contain no partial functional dependencies to be in 2NF.
Third Normal Form (3NF): Your table must be in 2NF and have no transitive dependencies.
Foreign Key: Your table must be in 2NF and have no transitive dependencies.
Composite Key: This is a primary key made up of multiple columns, which create a unique key value.