Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
14 views
3 pages
Hoc SQL
Uploaded by
nguyenduchuy010297
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download now
Download
Download as txt, pdf, or txt
Save HocSQL For Later
Download
Save
Save HocSQL For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
14 views
3 pages
Hoc SQL
Uploaded by
nguyenduchuy010297
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download now
Download
Download as txt, pdf, or txt
Save HocSQL For Later
Carousel Previous
Carousel Next
Save
Save HocSQL For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
Download as txt, pdf, or txt
You are on page 1
/ 3
Search
Fullscreen
/****** Tạo bảng QuanLyBanHang ******/
CREAT DATABASE QuanLyBanHang
USE QuanLyBanHang
CREATE TABLE KHACHHANG
(
MAKH char(4) primary key,
HOTEN varchar(40),
DCHI varchar(50),
SODT varchar(20),
NGSINH smalldatetime,
DOANHSO money,
NGDK smalldatetime
)
CREATE TABLE NHANVIEN
(
MANV char(4) primary key,
HOTEN varchar(40),
NGVL varchar(20),
SODT smalldatetime
)
CREATE TABLE SANPHAM
(
MASP char(4) primary key,
TENSP varchar(40),
DVT varchar(20),
NUOCSX varchar(40),
GIA money
)
CREATE TABLE HOADON
(
SOHD int primary key,
NGHD smalldatetime,
MAKH char(4),
MANV char(4),
TRIGIA money
)
CREATE TABLE CTHD
(
SOHD int primary key,
MASP char(4),
SL int
)
ALTER TABLE HOADON ADD
CONSTRAINT HD_MAKH_FK FOREIGN KEY (MAKH) REFERENCES KHACHHANG(MAKH),
CONSTRAINT HD_MANV_FK FOREIGN KEY (MANV) REFERENCES NHANVIEN(MANV)
ALTER TABLE CTHD ADD
CONSTRAINT CTHD_MASP_FK FOREIGN KEY (MASP) REFERENCES SANPHAM(MASP),
CONSTRAINT CTHD_SOHD_FK FOREIGN KEY (SOHD) REFERENCES HOADON(SOHD)
/****** Tạo bảng QuanLyGiaoVu ******/
/****** Tạo bảng QuanLyGiaoVu ******/
/****** Tạo bảng QuanLyGiaoVu ******/
/****** Tạo bảng QuanLyGiaoVu ******/
/****** Tạo bảng QuanLyGiaoVu ******/
CREAT DATABASE QuanLyGiaoVu
USE QuanLyGiaoVu
CREATE TABLE KHOA
(
MAKHOA varchar(4) primary key,
TENKHOA varchar(40),
NGTLAP smalldatetime,
TRGKHOA char(4)
)
CREATE TABLE MONHOC
(
MAMH varchar(10) primary key,
TENMH varchar(40),
TCLT TINYINT,
TCTH TINYINT,
MAKHOA varchar(4) REFERENCES KHOA(MAKHOA)
)
CREATE TABLE DIEUKIEN
(
MAMH varchar(10) REFERENCES MONHOC(MAMH),
MAMH_TRUOC varchar(10) REFERENCES MONHOC(MAMH)
)
CREATE TABLE GIAOVIEN
(
MAGV char(4) primary key,
HOTEN varchar(40),
HOCVI varchar(10),
HOCHAM varchar(10),
GIOITINH varchar(3),
NGSINH smalldatetime,
NGVL smalldatetime,
HESO numeric(4,2),
MUCLUONG money,
MAKHOA varchar(4) REFERENCES KHOA(MAKHOA)
)
CREATE TABLE LOP
(
MALOP char(3) primary key,
TENLOP varchar(40),
TRGLOP char(5),
SISO TINYINT,
MAGVCN char(4)
)
CREATE TABLE HOCVIEN
(
MAHV char(5) primary key,
HO varchar(40),
TEN varchar(10),
NGSINH smalldatetime,
GIOITINH varchar(3),
NOISINH varchar(40),
MALOP char(3) REFERENCES LOP(MALOP)
)
CREATE TABLE GIANGDAY
(
MALOP char(3) REFERENCES LOP(MALOP),
MAMH varchar(10) REFERENCES MONHOC(MAMH),
MAGV char(4) REFERENCES GIAOVIEN(MAGV),
HOCKY TINYINT,
NAM smallint,
TUNGAY smalldatetime,
DENNGAY smalldatetime
)
CREATE TABLE KETQUATHI
(
MAHV char(5) REFERENCES HOCVIEN(MAHV),
MAMH varchar(10) REFERENCES MONHOC(MAMH),
LANTHI TINYINT,
NGTHI smalldatetime,
DIEM numeric(4,2),
KQUA varchar(10)
)
ALTER TABLE KHOA ADD
CONSTRAINT KHOA_TRGKHOA_FK FOREIGN KEY (TRGKHOA) REFERENCES GIAOVIEN(MAGV)
ALTER TABLE LOP ADD
CONSTRAINT LOP_TRGLOP_FK FOREIGN KEY (TRGLOP) REFERENCES HOCVIEN(MAHV),
CONSTRAINT LOP_MAGVCN_FK FOREIGN KEY (MAGVCN) REFERENCES GIAOVIEN(MAGV)
You might also like
QLGV_luu
PDF
No ratings yet
QLGV_luu
4 pages
Cau 1
PDF
No ratings yet
Cau 1
2 pages
create database QuanLyGiaoVu
PDF
No ratings yet
create database QuanLyGiaoVu
3 pages
Create Database Qlbanhang
PDF
No ratings yet
Create Database Qlbanhang
2 pages
K15THO0022, Quach Chieu Phuoc
PDF
No ratings yet
K15THO0022, Quach Chieu Phuoc
5 pages
QLBH
PDF
No ratings yet
QLBH
2 pages
QLHV
PDF
No ratings yet
QLHV
3 pages
Back Up SQL
PDF
No ratings yet
Back Up SQL
5 pages
Bài Th1 - Trần Đức Lương
PDF
No ratings yet
Bài Th1 - Trần Đức Lương
6 pages
Bài TH C Hành Qu N Lý Sinh Viên
PDF
No ratings yet
Bài TH C Hành Qu N Lý Sinh Viên
13 pages
BT Hệ Quản Trị CSDL SQL
PDF
No ratings yet
BT Hệ Quản Trị CSDL SQL
6 pages
create database QLTHUVIEN
PDF
No ratings yet
create database QLTHUVIEN
4 pages
Midterm
PDF
No ratings yet
Midterm
11 pages
23521052_BT3
PDF
No ratings yet
23521052_BT3
17 pages
USE QLBanHang
PDF
No ratings yet
USE QLBanHang
5 pages
Bdmulta
PDF
No ratings yet
Bdmulta
2 pages
TrọngTrường (2331540262)
PDF
No ratings yet
TrọngTrường (2331540262)
5 pages
New Text Document
PDF
No ratings yet
New Text Document
2 pages
BT View
PDF
No ratings yet
BT View
3 pages
(Master) GO QLCD: 'QLNV - Data' 'C:/QLNV - Data - MDF'
PDF
100% (1)
(Master) GO QLCD: 'QLNV - Data' 'C:/QLNV - Data - MDF'
7 pages
Insert BT1
PDF
No ratings yet
Insert BT1
8 pages
sql
PDF
No ratings yet
sql
1 page
PhamCongThanh
PDF
No ratings yet
PhamCongThanh
10 pages
Code
PDF
No ratings yet
Code
4 pages
Baitap12 9
PDF
No ratings yet
Baitap12 9
2 pages
New Text Document
PDF
No ratings yet
New Text Document
3 pages
Create Database QLBH
PDF
No ratings yet
Create Database QLBH
12 pages
Bảng Ql Lịch Giảng Dạy
PDF
No ratings yet
Bảng Ql Lịch Giảng Dạy
2 pages
Tài liệu 5
PDF
No ratings yet
Tài liệu 5
4 pages
Sơ Đ ERD Và RDM
PDF
No ratings yet
Sơ Đ ERD Và RDM
1 page
Base de Datos para Tarea
PDF
No ratings yet
Base de Datos para Tarea
115 pages
Nguyễn Thị Thúy Hiền - TH1
PDF
No ratings yet
Nguyễn Thị Thúy Hiền - TH1
5 pages
tự luận tin thi cuối hk2 18 hoàng lâm
PDF
No ratings yet
tự luận tin thi cuối hk2 18 hoàng lâm
2 pages
Der Sis Vendas 01 06
PDF
No ratings yet
Der Sis Vendas 01 06
2 pages
FF
PDF
No ratings yet
FF
41 pages
Create Database QLBH
PDF
No ratings yet
Create Database QLBH
14 pages
Practica 6
PDF
No ratings yet
Practica 6
2 pages
Script TaoDatabase
PDF
No ratings yet
Script TaoDatabase
1 page
Update
PDF
No ratings yet
Update
3 pages
520H0647 - Bài 1
PDF
No ratings yet
520H0647 - Bài 1
2 pages
Tài-Liệu - 12
PDF
No ratings yet
Tài-Liệu - 12
4 pages
Create Database Quanlysinhvien
PDF
No ratings yet
Create Database Quanlysinhvien
7 pages
Thi TH
PDF
No ratings yet
Thi TH
3 pages
CSDL TH3
PDF
No ratings yet
CSDL TH3
6 pages
Is 401 02052024 Trigger Letronghuy 0473
PDF
No ratings yet
Is 401 02052024 Trigger Letronghuy 0473
8 pages
Create Database Layloihoi
PDF
No ratings yet
Create Database Layloihoi
2 pages
Script Tao Bang
PDF
No ratings yet
Script Tao Bang
5 pages
Qu N Lý Bán Hàng: Môhìnhc S D Liu
PDF
No ratings yet
Qu N Lý Bán Hàng: Môhìnhc S D Liu
24 pages
CSDL
PDF
No ratings yet
CSDL
4 pages
Lap5 24060120140160 Danang Wisnu Prayoga
PDF
No ratings yet
Lap5 24060120140160 Danang Wisnu Prayoga
7 pages
University Management System Solution
PDF
No ratings yet
University Management System Solution
8 pages
Data Defination Language
PDF
No ratings yet
Data Defination Language
3 pages
Tài Liệu
PDF
No ratings yet
Tài Liệu
4 pages
dbms cases
PDF
No ratings yet
dbms cases
64 pages
COMP2003 - Lesson 2
PDF
No ratings yet
COMP2003 - Lesson 2
17 pages
Not Null : 'Casablanca' 'Rabat' 'Tanger' 'Marrakech'
PDF
No ratings yet
Not Null : 'Casablanca' 'Rabat' 'Tanger' 'Marrakech'
2 pages
CSDL
PDF
No ratings yet
CSDL
5 pages
Create Database-Wps Office
PDF
No ratings yet
Create Database-Wps Office
16 pages
Adminturnos
PDF
No ratings yet
Adminturnos
2 pages
402 InformationTechnology Class X Sample Paper 1 AnswerKey
PDF
No ratings yet
402 InformationTechnology Class X Sample Paper 1 AnswerKey
5 pages
VL2024250102391 Ast04
PDF
No ratings yet
VL2024250102391 Ast04
2 pages
MySQL DBA Syllabus
PDF
67% (6)
MySQL DBA Syllabus
14 pages
DBMS Unit 9
PDF
No ratings yet
DBMS Unit 9
35 pages
Oracle To MySQL Conversion
PDF
No ratings yet
Oracle To MySQL Conversion
15 pages
Peh00001 Hana
PDF
No ratings yet
Peh00001 Hana
7 pages
Past Paper Database MCQs
PDF
No ratings yet
Past Paper Database MCQs
1 page
Cmis Cheatsheet PDF
PDF
100% (1)
Cmis Cheatsheet PDF
1 page
Ejercicios de Apex
PDF
No ratings yet
Ejercicios de Apex
4 pages
Galera Schema
PDF
No ratings yet
Galera Schema
78 pages
DBT_Mock4_0923 for Students
PDF
No ratings yet
DBT_Mock4_0923 for Students
11 pages
Advanced SQL Concepts
PDF
No ratings yet
Advanced SQL Concepts
55 pages
Tutorial 2 & 3 Update
PDF
No ratings yet
Tutorial 2 & 3 Update
29 pages
2019-Db-David Kurtz-Introduction To Active Sesssion History-Praesentation
PDF
No ratings yet
2019-Db-David Kurtz-Introduction To Active Sesssion History-Praesentation
75 pages
DBMS Record
PDF
No ratings yet
DBMS Record
25 pages
Data Storage Overview Sqlite Databases
PDF
No ratings yet
Data Storage Overview Sqlite Databases
22 pages
Oracle DBA Course Syllabus 1
PDF
No ratings yet
Oracle DBA Course Syllabus 1
3 pages
50 SQL Queries Series - Basic
PDF
No ratings yet
50 SQL Queries Series - Basic
25 pages
DB 222
PDF
No ratings yet
DB 222
21 pages
NoorLal 221370151
PDF
No ratings yet
NoorLal 221370151
3 pages
Unit 5
PDF
No ratings yet
Unit 5
11 pages
Board Practical Qp-20-23 Xii
PDF
No ratings yet
Board Practical Qp-20-23 Xii
10 pages
CH 13 Oracle
PDF
No ratings yet
CH 13 Oracle
32 pages
Jawaban Final Basis Data 1-60
PDF
No ratings yet
Jawaban Final Basis Data 1-60
5 pages
Advaced Database Tutorials.
PDF
No ratings yet
Advaced Database Tutorials.
2 pages
Oracle Final
PDF
No ratings yet
Oracle Final
64 pages
NoSql Intro
PDF
No ratings yet
NoSql Intro
24 pages
Lab Session 1-3
PDF
No ratings yet
Lab Session 1-3
13 pages
Movie Database
PDF
No ratings yet
Movie Database
3 pages
Chapter 5 Notes
PDF
No ratings yet
Chapter 5 Notes
11 pages