17. UPDATE
id
1
2
3
4
5
6
7
8
9
10
11
12
title
country
Casablanca
us
Blade Runner
us
On The Waterfront
us
Lawrence Of Arabia
uk
gb
Annie Hall
us
Goodfellas
us
The Third Man
uk
gb
Citizen Kane
us
Bicycle Thieves
it
The Battleship Potemkin ru
Sholay
in
A Better Tomorrow
hk
year_released
1942
1982
1954
1962
1977
1990
1949
1941
1948
1925
1975
1986
Data Manipulation Language
17
18. DELETE
id
1
2
3
4
5
6
7
8
9
10
11
12
title
country
Casablanca
us
Blade Runner
us
On The Waterfront
us
Lawrence Of Arabia
gb
Annie Hall
us
Goodfellas
us
The Third Man
gb
Citizen Kane
us
Bicycle Thieves
it
The Battleship Potemkin ru
Sholay
in
A Better Tomorrow
hk
year_released
1942
1982
1954
1962
1977
1990
1949
1941
1948
1925
1975
1986
Data Manipulation Language
18
19. SELECT
id
1
2
3
4
title
Casablanca
Blade Runner
On The Waterfront
Lawrence Of Arabia
country
us
us
us
gb
6
7
8
9
10
11
12
Goodfellas
The Third Man
Citizen Kane
Bicycle Thieves
The Battleship Potemkin
Sholay
A Better Tomorrow
us
gb
us
it
ru
in
hk
year_released
1942
1982
1954
1962
1990
1949
1941
1948
1925
1975
1986
19
99. create table people (peopleid
first_name
surname
born
died
int not null,
varchar(30),
varchar(30) not null,
numeric(4) not null,
numeric(4))
99
100. int not null,
primary key,
first_name varchar(30),
surname
varchar(30) not null,
born
numeric(4) not null,
died
numeric(4))
create table people (peopleid
100
101. create table people (peopleid
int not null
primary key,
first_name varchar(30),
surname
varchar(30) not null,
born
numeric(4) not null,
died
numeric(4))
101
102. create table people (peopleid
int not null
primary key,
first_name varchar(30),
surname
varchar(30) not null,
born
numeric(4) not null,
died
numeric(4) ,
unique (first_name, surname))
102
104. For Oracle, PostgreSQL and DB2 ...
'audrey'
'AUDREY'
'Audrey'
... not for SQL Server, MySQL or SQLite ...
104
105. create table people (peopleid
int not null
primary key,
first_name varchar(30),
surname
varchar(30) not null,
born
numeric(4) not null,
died
numeric(4),
unique (first_name, surname))
105
106. create table people (peopleid
int not null
primary key,
first_name varchar(30),
check (first_name = upper(first_name)),
surname
varchar(30) not null,
check (surname = upper(surname)),
born
numeric(4) not null,
died
numeric(4),
unique (first_name, surname))
106
109. create table movies (movieid
int not null primary key,
title
varchar(60) not null,
country
char(2) not null,
year_released numeric(4) not null
check(year_released >= 1895),
unique (title, country, year_released))
109
112. create table movies (movieid
int not null primary key,
title
varchar(60) not null,
country
char(2) not null,
year_released numeric(4) not null
check(year_released >= 1895),
unique (title, country, year_released)
foreign key(country)
references countries(country_code))
112
141. SQL : THE database language.
Connection : server, port, database, username,
password.
Create table: data types + constraints.
141
142. SQL : THE database language.
Connection : server, port, database, username,
password.
Create table: data types + constraints.
Keywords and identifiers: not case-sensitive
Data : can be CASE-SENSITIVE
142