SQL Constraints, Learn SQL, Codecademy, Manipulation

Channel:
Subscribers:
8,020
Published on ● Video Link: https://www.youtube.com/watch?v=MAgZSogIyWM



Duration: 2:04
133 views
0


Constraints allow us to specify how a column can be used. A constraint will tell the database to either accept or reject inserted data when it does not adhere to a certain type of restriction(constraint). We look at last lessons create table command. "CREATE TABLE celebs ( id INTEGER PRIMARY KEY, name TEXT UNIQUE, date_of_birth TEXT NOT NULL, date_of_death TEXT DEFAULT 'Not Applicable');" "PRIMARY KEY" column can be utilized to identify uniquely a row. When an identical row is attempted to be inserted, a constrain violation will not allow the new row to be inserted. "UNIQUE" columns must have a different value every row. The "NOT NULL" constraint tells our database that this column must always have a value. If a value is not given, a constraint violation will prohibit the row from being inserted. "DEFAULT" columns will take an argument additionally that will be an assumed value for a row, if a value is not specified.







Tags:
sql database
sql introduction
sql intro
should i learn sql
sql benefits
learn sql
constraints