Nhập môn Cơ sở dữ liệu quan hệ bằng SQL
Timo Grossenbacher
Data Journalist
NULL trong một cộtCREATE TABLE students (
ssn integer not null,
lastname varchar(64) not null,
home_phone integer,
office_phone integer
);
NULL != NULL
Khi tạo bảng...
CREATE TABLE students (
ssn integer not null,
lastname varchar(64) not null,
home_phone integer,
office_phone integer
);
Sau khi bảng đã được tạo...
ALTER TABLE students
ALTER COLUMN home_phone
SET NOT NULL;
ALTER TABLE students
ALTER COLUMN ssn
DROP NOT NULL;

CREATE TABLE table_name (
column_name UNIQUE
);
ALTER TABLE table_name
ADD CONSTRAINT some_name UNIQUE(column_name);
Nhập môn Cơ sở dữ liệu quan hệ bằng SQL