This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE QLBH | |
----------------------------------------------------- | |
----------------------------------------------------- | |
---------------------------------------------USE QLBH | |
-- KHACHANG | |
CREATE TABLE KHACHHANG( | |
MAKH char(4) not null, | |
HOTEN varchar(40), | |
DCHI varchar(50), | |
SODT varchar(20), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE DE_3 | |
USE DE_3 | |
--Tao cac bang | |
--NHAN_VIEN | |
CREATE TABLE NHANVIEN( | |
MaNV INT, | |
TenVN VARCHAR(30), | |
MaVT INT, | |
MaPB INT, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create database de6 | |
use de6 | |
alter table mon add | |
constraint cheack_e cheack (sotinchi between 1 and 4) | |
create trigger temp | |
on sinhvien | |
for insert,update | |
as | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--4.1 sp_ThongtinDocGia | |
create proc sp_ThongtinDocGia | |
(@ma_docgia smallint) | |
as | |
begin | |
if(exists(select * from NguoiLon where ma_docgia=@ma_docgia)) | |
select * from DocGia d join NguoiLon n on d.ma_docgia=n.ma_docgia where n.ma_docgia=@ma_docgia | |
else | |
select * from DocGia d join TreEm k on d.ma_docgia=k.ma_docgia where k.ma_docgia=@ma_docgia | |
end |