Class 06 Flashcards
docker database
what is char(n)?
fixed string
what is varcar(n)?
variable string
what is a float?
real numbers
what should always be included in a table?
a primary key
what is a unique constraint?
you want something to appear once
what is a foreign key?
reference to another table
(can match primary key values in other tables + may have nulls)
what is “not null”?
a participation constraint useful for attributes
what is “current_timestamp” useful for?
time stamps you can backtrack to
what is “alter table” for?
allows to modify a table structure
what is “add” for?
“add” a new field
what is “insert into (2)” for?
inserts tuples into tables
how can you update your code?
- “update” relation
- “set” list_on_assignments
- “where” selection_condition;
what does “delete” do?
removes matching rows from a table where conditions are met
- “delete from” person
- “where” id = ‘1234’ ;
what does “truncate table” do?
removes all data rows in a table but the table still exists (schema (structure) remains the same)