Uploaded by Abdul Sattar

DB

advertisement
CREATE DATABASE DB
CREATE TABLE Products (
Product_ID int,
Product_Name varchar(255),
Supplier_ID int,
Category varchar(255),
Quantity_Per_Units varchar(255),
Unit_Pric varchar(255),
Unit_Cost varchar(255),
Units_In_Stock int,
Units_In_Order int,
Record_Level int
);
Alter Table Products add
Category_ID int foreign key references
Categories(Category_ID)
Alter Table Products add
Supplier_ID int foreign key references Suppliers(Supplier_ID)
INSERT INTO Products
VALUES (1,'Chai',1234,'11','10 Boxes x 20 bags ','$18.00','$9.60',39,0,10 );
INSERT INTO Products
VALUES (2,'Chang',1234,'11','24-12 oz bottles ','$19.00','$1.80',17,40,25 );
INSERT INTO Products
VALUES (3,'Aniseed Syrup',1234,'22','12-550 ml bottles ','$10.00','$3.50',13,70,25 );
INSERT INTO Products
VALUES (4,'Chef Anton s Cajun Seasoning',2134,'22','48-6 oz Jars
','$22.00','$12.79',53,0,0 );
INSERT INTO Products
VALUES (5,'Chef Anton s Bumbo Mix',2134,'22','36 Boxes ','$21.35','$8.80',0,0,0 );
INSERT INTO Products
VALUES (6,'Grandma s Boysenberry Spread',3124,'22','12-8 oz Jars
','$25.00','$10.50',120,0,25 );
INSERT INTO Products
VALUES (7,'Uncle Bub s Organic Dries Pears',3124,'77','12-1 lb pkgs
','$30.00','$18.00',15,0,10 );
INSERT INTO Products
VALUES (8,'Northwoods Cranberry Sauce',3124,'22','12-12 oz Jars
','$40.00','$65.00',6,0,0 );
INSERT INTO Products
VALUES (9,'Mishi Kobe Niku',4143,'$66.00','18-500 g pkgs ','$97.00','$65.00',29,0,0
);
INSERT INTO Products
VALUES (10,'Ikura',4143,'88','12-200 ml Jars ','$31.00','$21.00',31,0,0 );
Create Table Categories (
Category_ID int NOT NULL PRIMARY KEY,
Category_Name varchar(255),
Description varchar(255)
);
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INTO Categories
(11,'Beverages','Soft Drinks,Coffees,teas,beers and ales');
INTO Categories
(22,'Condiments','Sweet and savory sauces, rolishes,spreads, and seasonings');
INTO Categories
(33,'Confections','Desserts,candles, and sweet breads');
INTO Categories
(44,'Dairy Products','Cheeses');
INTO Categories
(55,'Grains/Cereals','Breads,crackers,pasta, and cereal');
INTO Categories
(66,'Meat/Poultry','Prepared Meat');
INTO Categories
(77,'Produce','Dried fruit and bean cure');
INTO Categories
(88,'Seafood','Seawood and fish');
CREATE TABLE Suppliers(
Supplier_ID int NOT NULL PRIMARY KEY,
Company_Name varchar(255),
Contact_Name varchar(255),
Contact_Title varchar(255),
Address varchar(255),
City varchar(255),
Region varchar(255),
Postal_Code int,
Country varchar(255),
Phone varchar(255),
Fax varchar(255),
HomePage varchar(255)
);
INSERT INTO Suppliers
VALUES(1234,'Exotic Liquies','Charlotte Cooper','Purchasing Manager','49 Gilbert
St.','London','',1245,'UK','(171)555-2222','','' );
INSERT INTO Suppliers
VALUES(2134,'New Orleans Cajun delights','Sheliey Burke','Order
Administrator','P.O.Box 78934','New Orleans','LA',70117,'USA','(100)5554822','','http://www.Cajun.com');
INSERT INTO Suppliers
VALUES(3124,'Grandma Kelly Homestead','Ragina Murphy','Sales Representative','707
Oxford Rd.','ArnArbor','MI',48104,'USA','(313)555-5735','(313)555-3349','' );
INSERT INTO Suppliers
VALUES(4143,'Tokyo Traders','Yoshi Nagase','Marketing Manager','98 Sekimal
Musashinosl','Tokyo','',103,'Japan','(03)3555-5011','','' );
INSERT INTO Suppliers
VALUES(5136,'Cooperativade Quesos LasCabras','Antoniodel Vale Saaved','Export
Administrator','Calle del Rosal
4','Oviado','Asturlias',33007,'Spain','(98)5387653','','');
INSERT INTO Suppliers
VALUES(6743,'Mayumls','Mayumi Ohro','Marketing Representative','92SETIUKO cHUOKU','oSKA','',545,'jAPAN','(06)4317877','','http://www.microsoft.com/accessdev.html');
select*
from Products
where Unit_Pric>'$20.00'
select*
from Products
where Unit_Pric between '$30.00' and '20.00'
order by Unit_Pric asc
select*
from Products
where Product_Name like 'Chang'
Download