Anh Hoàng

42 bundles
1 file5 months ago
1

USE MASTER

1234567891011121314151617181920212223242526
USE MASTER GO IF DB_ID('DB') IS NOT NULL DROP DATABASE DB GO CREATE DATABASE DB GO USE DB CREATE TABLE TABLE_01( COLUMN_T1 NVARCHAR(50) CONSTRAINT PK_T1 PRIMARY KEY, COLUMN2_T2 NUMBER DEFAULT 5000 ) CREATE TABLE TABLE02( COLUMN_T2 NVARCHAR(50) CONSTRAINT PK_T2 PRIMARY KEY, COLUMN2_T2 NUMBER DEFAULT 5000, COLUMN3_T2 NVARCHAR(100) UNIQUE, COLUMN4_T2 NVARCHAR(3) CONSTRAINT CK_C4 CHECK(COLUMN4_T2 IN (N'Nam', N'Nữ')) ) // Them khoa ngoai ALTER TABLE TABLE_01 ADD CONSTRAINT FK_T1_T2 FOREIGN KEY (COLUMN1) REFERENCES TABLE02(COLUMN_T2);