Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
968 B
4
Indexable
Never
// CÂU 1
CREATE USER TenNhom01_Nhom12 IDENTIFIED BY TenNhom01_Nhom12;
GRANT CREATE SESSION TO TenNhom01_Nhom12;
GRANT CREATE TABLE TO TenNhom01_Nhom12 WITH ADMIN OPTION;

// CÂU 2
CREATE TABLE KhachHang (
  MaKH NVARCHAR2(4) PRIMARY KEY,
  TenKH NVARCHAR2(50) NOT NULL,
  DiaChi NVARCHAR2(255),
  MST NVARCHAR2(12),
  DienThoai NVARCHAR2(10),
  SoTaiKhoan NVARCHAR2(12)
);

CREATE TABLE HANGHOA (
    MAHANG NVARCHAR2(4) primary key,
    TENHANG NVARCHAR2(50) NOT NULL,
    QUICACH NVARCHAR2(10),
    DVT NVARCHAR2(10),
    DMHAOHUT float,
    DONGIA integer
);

CREATE TABLE HOADON (
    SOHD NVARCHAR2(4) primary key,
    NGAYLAP DATE,
    SOTIEN float,
    ThueGTGT float,
    PhiGT float,
    MaKH NVARCHAR2(4) REFERENCES KHACHHANG (MAKH)
);

CREATE TABLE CHTIETHOADON(
    SOHD NVARCHAR2(4) primary key,
    MAHANG NVARCHAR2(4) REFERENCES HANGHOA (MAHANG),
    SOLUONG integer,
    DONGIA integer,
    thanhtien integer
);
Leave a Comment