0% found this document useful (0 votes)
18 views2 pages

Nhanvien

The document creates and populates tables for a student grade database including tables for users, students, and grades. It creates the tables, defines primary and foreign keys, and inserts sample data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Nhanvien

The document creates and populates tables for a student grade database including tables for users, students, and grades. It creates the tables, defines primary and foreign keys, and inserts sample data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

use master

go

if exists (select * from sys.databases where name = 'FPL_DaoTao')


Drop database FPL_DaoTao
go

create database FPL_DaoTao


use FPL_DaoTao
go

create table USERS(


username nvarchar(50) primary key,
Pasword nvarchar(50),
roles nvarchar(50)

);

go

create table STUDENTS(


MASV nvarchar(50) primary key,
HoTen nvarchar(50),
Email nvarchar(50),
SoDT nvarchar(50),
GioiTinh bit ,
DiaChi nvarchar(50),
Hinh nvarchar(50)
);

go

create table GRADE(


ID int primary key identity,
MASV nvarchar(50) references STUDENTS(MASV),
TiengAnh int,
TinHoc int,
GDTC int
);

go

insert into USERS values('quytv', '123', N'�?ào Tạo')


insert into USERS values('nguyennv', '123', N'Giảng Viên')
insert into USERS values('truongdt', '123', N'Giảng Viên')

go
insert into STUDENTS values('PS22871',N'Trương Văn
Quý','[email protected]','0968651321','',N'Hoài Mỹ, Hoài Nhơn, Bình �?ịnh',
'')
insert into STUDENTS values('PS23124',N'Nguyễn Thị Ng�?c
Mai','[email protected]','0354564117','',N'23/15 Hồ Thị Kỷ, TP.HCM', '')
insert into STUDENTS values('PS23579',N'Phạm Văn
Trí','[email protected]','0908912385','','87 Bành Văn Trân, TP.HCM', '')
insert into STUDENTS values('PS22345',N'Văn Mai
Hương','[email protected]','0918712458','',N'45 Thành Thái, TP.HCM', '')

go
insert into GRADE(MASV,TiengAnh,TinHoc,GDTC) values('PS22871',8,7,4)
insert into GRADE(MASV,TiengAnh,TinHoc,GDTC) values('PS23124',6,8,7)
insert into GRADE(MASV,TiengAnh,TinHoc,GDTC) values('PS23579',8,8,7)
insert into GRADE(MASV,TiengAnh,TinHoc,GDTC) values('PS22345',7,5,9)

select * from STUDENTS

UPDATE STUDENTS SET MASV =

drop FK__GRADE__MASV__5FB337D6"

You might also like