0 ratings0% found this document useful (0 votes) 46 views8 pagesDBMS Practice Table
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
27. Consider the following table “Teachers”
Rollno | Student Name | DOB | Address | Mobile_no | Gender | Percentage
1 Jugal 10/01/2003 | Mumbai | 8555555555 | M 98
2 Pratigya 24/03/2002 | Pune | 444baaaaag | F 82
3 ‘Sandeep 12/12/2008 | Delhi essggegass | M on
4 ‘Sangeeta 01/07/2004 | Banglore | eseseesa6s | F 96
5 Sati os/0972002 | Mumbai | 777777777 | M 89
Write S@L commands:
a. To display all the information from the table whose adress is ‘Mumbai.
[Answer ~ Select rom students where address = *Mumbar’
b. To list the detalls ofall the students whose percentage is between 90 to 100.
Answer — Selec ftom students whore percentage >= 90 and percentage <= 100;
¢. To alsplay the name ofall the students whose gender Is Female.
Answer — Select Subject from students where Gender =
d. To display the list of names of all the students in alphabetical order.
‘Answer - Select * from students order by Student_name;29. Write the SQL commands to answer the queries based on Fabric table
FabyiclD Fname Type Dise
Foot Shirt Woolen 10
Fo02 Suit Coton 20
Fo03 Tunic Coton 10
Foo leans Denim 5
2. Write a query for insert the following record
(“F005”, “Kurta”, “Woollen”, 5)
Answer ~ insert into Fabric values ('F00S', ‘Kurta’, ‘Woolen’.§);
'b, Write a query to display only those fabric whose disc is more than 10
Answer ~ solect * from Fabric whore Dise>10;
¢. To display those record whose type Is ‘Woolen’
‘Answer ~ select * from Fabric where type = Woolen’;
4. To modify the fabric shirt by increasing discount by 10
Answer ~ update fabric set Disc = Disc + 10 where Frame = ‘Shirt’;
€. To delete the record of fabric F003 from table
Answer — delete from Fabric where FabricID = F003";30. Consider the following Vendor table and write the queries
VendoriD Name DateofRegistration Location
voo1 Mother Dairy 20-01-2009 Delhi
voo2 Havmor 01-04-2015 Gujrat
vo03 Amul 12-05-2012 Kolkata
voo4 Kwality Walls 16-10-2013 ‘Mumbai
‘a. Write a Query to display all records
Answer ~ Solect * from Vendor;
b. Write a Query to add a new row with the following details
(,V005", ,Vadilal", 2010-03-20", , Pune")
"Answer ~ Insat into Vendor values ("V00S",“Vadila, "2010-08-20", Pune");
‘Write a query to modity the location of VO0S from Kolkata to Gujrat
Answer ~ Update Vendor Set location= "Gujrat" Whore location= “Kolkata;‘31. Consider the following table “ITEM
ltemne Iname Price Quantity,
" Soap 40 80
2 Powder 80 30
33 Face cream 250 25
44 ‘Shampoo 120 100
56 ‘Soap box 20 50
a. Display the total amount of each item. The amount must be calculated as the price multiplied
by quantity for each item.
‘Answer — Select price * quantity rom iter;
b. Display the detalls of items whose price Is less than 50.
‘Answer — Solect * from item where price < 50;21. Consider the table Product and write SQL queries for the following :
Table : Product
PID PNAME PRICE QUANTITY CATEGORY
Pot BOARD 10000 2 OFFICE
P02 EYELINER _| 700 50 MAKEUP
P04 PENCIL 5 500 SCHOOL
POS LAMP 250 10 DOMESTIC
Pos BEDSHEET 450 45 DOMESTIC
Pog LAPTOP 75000 15 OFFICE
(a) To display names of all products whose category is “domestic”.
(b) To display produet name and price whose quantity is less than 50.
(©) To display price and quantity of Laptop.
(d) To display name and quantity of those products whose price is above
5000.4, Answer any 5 out of the given 6 questions. 5x1.
@
Gi
)
(iv)
14-89
w
(wi)
In OpenOffice Base, the relationship applied on the tables can be
removed with the help of option.
(A) Clear (B) Remove
(©) Drop (D) Delete
In SQL, the keyword to display records in ascending order is :
(A) Asee (B) Iner
(C) Ase (D) High
is a numeric data type which can store Yes/No type values
in the form of 0 or 1 in OpenOffice Base table.
(A) Boolean (B) Char
© Binary (D) OtherObject
Which of the following statement retrieves zero or more rows from
one or more database tables or database views ?
(A) UPDATE (B) DELETE
(©) SELECT (D) DISPLAY
"1 P.T.O.
Roshni has created a table Customer in SQL and wants to store
photograph image of every customer under Cust_photo field.
Suggest a suitable data type from the options given below.
(@) IMAGE
(8) PICTURE
(©) LONGVARBINARY
(D) GRAPHIC
By default, all the fields in OpenOffice Base will have __
datatype.
(A) int (tiny) (B) Boolean
(© text (varchar) (D) text (char)19. Explain any four data types of DBMS.
20. (a) Structure of a table “Orders” is given below. Suggest suitable data
type of each column,
Table : Orders
Order_ID | Order_date | Customer_ID | Amount
A101 12/19 C3445, 1200.00
‘A202 11/09/19 C1245, 3456.00
A402 og07/9 Czab 2312.00
(b) Consider the following table Books".
BKID, BkName Author | Qty | Price
B_101 | Learning with Fun _| Jacobins 5 | __855.00
B_103 | How I Live Now Meg Rosoft 4_| 400.00
B_104 | TCapture the Castle | Dodie Smith [5 [520.00
B_106 | Mortal Engines Philip Reeve | 4 | 260.00
B11) | The Kite Rider Geraldine 3 | 270.00
McCaughrean
Write SQL queries to
() Display data of all books whose quantity is more than 3.
ii) Display total amount of all books whose price is less than 500,
(Hint : amount = Qty x Price)
14, What is a Primary Key ? How is it different from foreign key ?ii) Which of the following is expanded form of SQL ?
Gv)
©)
(i)
(a) Systematic Query Language
(b) Structured Query Language
(© Software Query Language
G@) Structural Query Language
is usually suitable for less amount of data, (Relational/Flat
file)
Binary data types in a database can be using for storing.
(a) photos, music files, ete. (b) integer values:
(©) only image files (a) only video files
clause can be used with the SELECT statement in SQL to
specify which rows to retrieve from the table.
(@) WHERE (>) GROUP
© SAME (a) SIMILAR
Page 9 of 16 wero.