CREATE DATABASE AssigmentQLSV
IF OBJECT_ID('USERS') IS NOT NULL
	DROP TABLE USERS 
GO
CREATE TABLE USERS
(
	username nvarchar(50),
	password  nvarchar(50),
	role nvarchar(20)
	CONSTRAINT PK_USERS PRIMARY KEY (username)
)
IF OBJECT_ID('STUDENT') IS NOT NULL
	DROP TABLE STUDENT 
GO
CREATE TABLE STUDENT
(
	MASV NVARCHAR(15),
	HOTEN NVARCHAR(20),
	EMAIL NVARCHAR(30),
	SODT NVARCHAR(15),
	GIOITINH BIT,
	DIACHI NVARCHAR(50),
	HINH NVARCHAR(15)
	CONSTRAINT PK_STUDENT PRIMARY KEY (MASV)
)
IF OBJECT_ID('GRADE') IS NOT NULL
	DROP TABLE GRADE 
GO
CREATE TABLE GRADE
(
	ID INT,
	MASV NVARCHAR(15),
	TIENGANH INT,
	TINHOC  INT,
	GDQP INT 
	CONSTRAINT PK_GRADE PRIMARY KEY (ID),
	CONSTRAINT FK_GRADE_STUDENT FOREIGN KEY (MASV) REFERENCES STUDENT
)

SELECT* FROM  USERS
SELECT *FROM STUDENT
SELECT * FROM GRADE
