Professional Documents
Culture Documents
CustomerName varchar(20),
Primary Key(CustomerID)
};
Price decimal,
Primary Key(Product)
};
Primary Key(CustomerID,Product)
};
Update Poduct
Select RentalStartDate,RentalEndDate
From Rental
Where RenatlEndDate=’30/01/2015’
Alter
Alter table Customer
Add age int
Drop
Create table Customer
{
CustomerID varchar(30) not null,
CustomerName varchar(30).
Primary Key (CustomerID)
};
Transaction/Relation T1 T2 T3 T4 T5 T6
Film C C R R U
Rent C R R
Customer D R
Transaction/Relation T1 T2 T3 T4 T5 T6
Member D U R
Class_Booking C R
Class C U R
Delete
From Patient
Where FirstName=’Gemma’
AND LastName=’Jones’
Select *
From tblCustomer
Order By Town
Select
tblCustomer
Order BY DateOFBirth
Select FirstName,Surname,NoofAssessments
From Student s,Module m, AssessmentResult ar
Where s.StudentID=ar.StudentID
AND m.ModuleID=ar.ModuleID
Select EmployeeID,Surname,Department
From tblEmployee
Where Department=’Grocery’
Select SupermarketID,SupermarketName,Town
Form tblSupermarket
Where Employee>=35
Select e.EmployeeID,e.FirstName,e.Surname,s.SupermarketName
From tblEmployee e,tblSupermarket s,tblEmployeeSupermarket es
Where e.EmployeeID=es.EmployeeID
AND s.SupermarketID=es.Supermarket
AND e.Department=’Grocery’
Select*
From tblSalesRep
Order By DESC
Select s.RepID,s.FirstName,s.Surname,c.ContactName,c.Town
From tblSalesRep s,tblCompany c,tblRepCompany rc
Where s.RepID=rc.RepID
AND c.CompanyID=rc.CompanyID
AND c.No_of_Employees>=100
Select CompanyID,CompanyName,Town
From tblCompany
Where Town=’Nelson’
Select *
From tblStudent
Order By School
Select s.StudentID,s.FirstName,s.Surname
From tblStudent s,tblModule m,tblStudentModule sm
Where s.StudentID=sm.StudentID
AND m.ModuleID=sm.ModuleID
AND m.ModuleCode=1
Order By School DESC
Select s.StudentID,s.FirstName,s.Surname
From tblStudent,tblmodule
Where s.StudentID=sm.StudentID
AND m.ModuleID=sm.ModuleID
AND m.Title=’Systems Analysis’