Facebook
From Gamboge Frog, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 201
  1. create database Alpha_1
  2.  
  3. create table Supplier(
  4. SupplierID INT Primary key Not Null,
  5. SupplierName Varchar(50) Not Null,
  6. City Varchar(50) Not Null,
  7. Postcode INT Null,
  8. Supp_State varchar(50) Not Null,
  9. ContactNo Varchar(20) Not Null,
  10. Email Varchar(20) Not Null);
  11.  
  12.  Select * from Supplier
  13.  
  14.  Create table Category(
  15.  CategoryID INT Primary Key Not null,
  16.  CategoryName Varchar(30) Not Null);
  17.  
  18.  create table Customer(
  19.  CustomerID INT Primary key Not Null,
  20.  FirstName Varchar(30) Not Null,
  21.  LastName Varchar(30) Not Null,
  22.  ContactNo Varchar(20) Not Null,
  23.  Email Varchar(30) Null);
  24.  
  25.  select * from Customer
  26.  
  27.  Create table Product(
  28.  ProductID INT Primary Key Not Null,
  29.  ProductName Varchar(50) Not Null,
  30.  UnitPrice Dec(5,2) Not Null,
  31.  Quantity INT Not Null,
  32.  CategoryID INT Not Null, Foreign key (CategoryID) References Category ON Update Cascade);
  33.  
  34.  select * from Product
  35.  
  36.  Create Table Purchase(
  37.  PurchaseID INT Primary Key Not NUll,
  38.  PurchaseQuantity INT Not Null,
  39.  PurchaseDate Date Not Null,
  40.  CustomerID INT Not Null, Foreign Key(CustomerID) References Customer ON Update Cascade,
  41.  ProductID INT Not Null, Foreign key(ProductID) References Product ON Update Cascade);
  42.  
  43.   select * from Purchase
  44.  
  45.   Create Table Employee(
  46.   EmployeeID INT Primary key Not Null,
  47.   FirstName VarChar(30) Not Null,
  48.   LastName VarChar(30) Not Null,
  49.   EmpEmail VarChar(30) Not Null);
  50.  
  51.   Create Table OrderProduct(
  52.   OrderID INT Primary KEy Not Null,
  53.   OrderDate Date Not Null,
  54.   EmployeeID INT Not Null, Foreign key(EmployeeID) References Employee ON Update Cascade,
  55.   ProductID INT Not Null, Foreign key(ProductID) References Product On Update Cascade);
  56.  
  57.    select * from OrderProduct