The document creates a database called QLDETAI_SV and defines three tables: SINHVIEN to store student data, DETAI to store project data, and SINHVIEN_DETAI to store the many-to-many relationship between students and projects. It inserts sample data into all three tables to demonstrate the structure.
The document creates a database called QLDETAI_SV and defines three tables: SINHVIEN to store student data, DETAI to store project data, and SINHVIEN_DETAI to store the many-to-many relationship between students and projects. It inserts sample data into all three tables to demonstrate the structure.
The document creates a database called QLDETAI_SV and defines three tables: SINHVIEN to store student data, DETAI to store project data, and SINHVIEN_DETAI to store the many-to-many relationship between students and projects. It inserts sample data into all three tables to demonstrate the structure.
MASV CHAR(6) NOT NULL, TENSV NVARCHAR(30) NOT NULL, SODT VARCHAR(10), LOP CHAR(6) NOT NULL, DIACHI NVARCHAR(50) NOT NULL, CONSTRAINT pk_SINHVIEN PRIMARY KEY(MASV) ) GO
CREATE TABLE DETAI(
MADT CHAR(6) NOT NULL, TENDT NVARCHAR(50) NOT NULL CONSTRAINT pk_DETAI PRIMARY KEY(MADT) ) GO
CREATE TABLE SINHVIEN_DETAI(
MASV CHAR(6) NOT NULL, MADT CHAR(6) NOT NULL, NGAYBAOCAO DATETIME, CONSTRAINT pk_SINHVIEN_DETAI PRIMARY KEY(MASV, MADT),
VALUES('SV0001',N'Nguyễn Văn A', '0909029530','DTH04','Bình Chánh') INSERT INTO SINHVIEN(MASV,TENSV,SODT,LOP,DIACHI) VALUES('SV0002',N'Nguyễn Văn B', '0909029531','DTH04','Bình Chánh')
INSERT INTO DETAI(MADT,TENDT) VALUES('DT0001',N'Đồ Án Cơ Sở')
INSERT INTO DETAI(MADT,TENDT) VALUES('DT0002',N'Đồ Án Tốt Nghiệp')
INSERT INTO SINHVIEN_DETAI(MASV,MADT) VALUES('SV0001',N'DT0001')
INSERT INTO SINHVIEN_DETAI(MASV,MADT) VALUES('SV0001',N'DT0002')
INSERT INTO SINHVIEN_DETAI(MASV,MADT) VALUES('SV0002',N'DT0001')
INSERT INTO SINHVIEN_DETAI(MASV,MADT) VALUES('SV0002',N'DT0002')