Untitled

mail@pastecode.io avatar
unknown
plain_text
23 days ago
598 B
1
Indexable
Never
ALTER TABLE KHACHHANG 
ALTER COLUMN [Customer ID] char(10) not null

ALTER TABLE KHACHHANG
ADD CONSTRAINT PK_KHACHHANG PRIMARY KEY ([Customer ID])

SELECT COUNT(*) FROM Orders

SELECT COUNT(DISTINCT [ORDER ID])
FROM Orders

SELECT COUNT(DISTINCT [ROW ID])
FROM Orders

ALTER TABLE ORDERS
ALTER COLUMN [CUSTOMER ID] CHAR(10) NOT NULL

ALTER TABLE ORDERS
ALTER COLUMN [ROW ID] INT NOT NULL

ALTER TABLE ORDERS
ADD CONSTRAINT PK_ORDER PRIMARY KEY ([ROW ID])

ALTER TABLE ORDERS
ADD CONSTRAINT FK_ORDERS_KHACHHANG FOREIGN KEY ([CUSTOMER ID])
REFERENCES KHACHHANG([CUSTOMER ID])
Leave a Comment