Вы находитесь на странице: 1из 18

Create the following table

Emp
EmpId Number
Ename Short text
City Short text
Dept Short text
Contact Number
Salary
EmpId Number
Amount Number
DateOfSalary Date/Time

Create a relationship between Emp and Salary


Perform referential integrity
Perform Cascade update and delete operation on it.
Exercise
1. EmpId cant be zero value
Validation rule <>0
2. Ename cant be empty
Validation rule Is not null
3. Set the default value for City Jamnagar
Default value : Jamnagar
4. Contact number should be of 10 digits only.
Field size :10
5. Amount of Salary table must be >5000 and <40000
>5000 and <40000
6. DateofSlary must be below <2016 .
<#12/31/2016#
Create the following tables
Student
Rno Number
Sname Short text
Class Short text
Gender Short txt
City Short text
Per Number

1. Select Rno,Sname,Class from student where Class =


FYBBA-A
2. Select Rno,Sname,Class from student where Class =
FYBBA-C
3. Select Rno,Sname,Class and Gender from student
where Gender = M
4. Select Sname,Ctiy from student where City = JAM
5. Select Rno,Sname and Per where Per>60
6. Select Rno,Sname,per and class where per >70 and
<90
7. Select rno ,snmae,class where sname starts with J
8. Ans is J*
Book
Rno Number
BookId Number
Title Short text
Author Short text
Price Number

Create a relationship between Student and Book


Perform referential integrity
Perform Cascade update and delete operation on it.
1. Rno cant be negative
2. Sname cant be empty
3. Gnd field must accept either M or F
4. Set the default value for Author
5. Price must be between 100 and 500.
Book
Rno Number
BookId Short text .eg B001, C001
Title Short text
Author Short text (Lookup wizard)
Price Number
DOI Date/Time

1. Select Title,Author from Book where Author = JG.


2. Select all the details of book whose starting letter
starts with A like A*
3. Select Rno,Title and price where price >500
4. Select all the details of book where DOI >jan 2017
and <feb 2017.
5. Select Title and BookId where BookId = B001.
6. Select Title and BookId where BookId = C001.
Product

Queries
1. Select all the details of customer where customer
name=adam
2. Select item, quantity and order date where
item=pears
3. Select item, quantity and order date where qty >10
and 20
4. Select all the details of customer where orderdate
>jan/2017 and <march/2017
5. Select item, quantity and order date where
item=oranges or grapes.
6. Select customer ,item where item starts with=S
Result
Rno Auto Number
Sname Short text (Lookup wizard)
Sub1 Number
Sub2 Number
Per Number

1. select rno,sname of student where sname starts


with J
2. select all the details of student where sub1>60
3. select all the details of student where sub2>70
4. select all the details of student where Per>=60 and
<90.
Calculate query ExerciseGenerate the following table
using calculated query

Product
ProdId Auto Number
ProductName Short text (lookup wizard)
Qty Number
Price Number
Total (using query).

Salary
EmpId Auto Number
EmpName Short text (lookup wizard)
PerDaySal Number
Weekly Number (using query).
Monthly Number (using query).
Yearly Number (using query).
Purchase
PId Auto Number
ProdName Short text (lookup wizard)
QTY Number
CostPrice Number
Total Number (using query).
Discount 5% Number (using query).
Gtotal Number(using query)

Create the following table

Student
Sid Auto Number
Sname Short text (lookup wizard)
Class Short text
Contact Short text
City Short text (lookup wizard)

Create the StudentBackup table using Make table query.


Create the following table
Emp
EmpId Auto number
Ename Short text
DOJ Date/time
City Short text
Contact Number

Salary
EmpId Auto number
Ename Append from Emp
DOJ Append from Emp
City Append from Emp
Salary Number

Create the EmpBackup and SalaryBacup table using make


table query.
Student
Sid Auto Number
Sname Short text (lookup wizard)
Class Short text
Contact Short text
City Short text (lookup wizard)

Result
Rno Auto Number
Sname Append from Stud
Sub1 Number
Sub2 Number
Per Number

Create the Student and Result Backup table using Make


table query.
Query Exercise
Product Table

1. Select the product having price 20


2. Select the product having qty >50 and <100
3. Select the product having price 20 and 30 In(20,30)
4. Calculate the total filed.
5. Find out the field where price is missing.
6. Give 2% discount on each product.
Create the following table

1. Select all the Customer having CustName starting


with J.
2. Select all the customer having Oder = CD.
3. Display CustName,Order,Contact where contact
starts with =95. Ans (like 95*)
4. Display all the records of customer where order date
is between Jan-2017 and Feb-2017.
>#1/01/2017# And <#2/28/2017#
5. Select CustName, Order and Total where Total is
above 2000 and below 5000.
6. Display all the details of product having CD and -
Pendrive. Ans in(CD,Pendive)
BookId Auto number
BookName Short text
Author Short text
Location Short text (lookup wizard).
ROW1,ROW2,ROW3
Price Number
DOI Date time
Available Yes / no
Book

1. Display all the available books.


2. Find the books where location = ROW1.
3. Select all the books Title Starting with Acc.
4. Select all the books having name Maths and IT.
5. Select all the books that are issued after jan-2017.
6. Display all the books which are not available.
7. Display all the books which are located in ROW2 and
ROW3.
8. Select all the books having price 150.
9. Select all the books having price >100 and <300.
10. Select all the books having author as JG.
Exercise on update and delete records
Create the customer table

1. Display the custName,contact of all customers where


order is CD and DVD.
2. Update the contact of as 95111 22255 where custname is
Jay.
3. Update the order of cust as Keyboard where products
are CD.
4. Delete all the records of Customer where order are placed
in month of Jan-2017.
5. Delete all the records where order = Keybord.
Create the product table

1. Select all the product using Parameter query using


ProdName.
2. Select All the products having qty =10 using Parameter
Query.
3. Select All the products having qty >100 using Parameter
Query.
4. Select All the products having qty<80 using Parameter
Query.
5. Update the price of product as 100 where ProdId=12.
6. Update the ProdName as DairyMIlk where
ProdName=DaryMilk.
7. Update the qty of product as 250 where Price>160.
8. Delete all the records where Price is Null.
9. Delete all the records where ProdName is Choco.
Crosstab Query exercise

Sales table

1. Find the total sum of sales according to sales month


2. Count the total number of sales according to sales month.
3. Calculate the maximum sales of employee.
4. Calculate the minimum sales of employee.
5. Count the number of sells done by employee.
Emp
EmpId Autonumber
EmpName Short text
Dept Short text
Post Short text
Salary Number

1. Find the Department wise employee and calculate the


salary.
2. Calculate the salary of Employee according to Post.
3. Count the total number of Employee according to Dept.
4. Calculate the maximum salary according to dept.
5. Calculate the minimum salary according to dept.
1. Count the total number of students according to class.
2. Count the total number of students according to
stream.
3. Find the maximum per according to class.
4. Find the maximum per according to stream.

Вам также может понравиться