0% found this document useful (0 votes)
1 views

doc3_4 mark sql

The document outlines various SQL database management tasks for different organizations, including creating tables, inserting data, and deleting records. It specifies the structure of databases and tables, attributes suitable for primary keys, and commands for managing data. Additionally, it includes questions related to database design and SQL queries for data manipulation.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

doc3_4 mark sql

The document outlines various SQL database management tasks for different organizations, including creating tables, inserting data, and deleting records. It specifies the structure of databases and tables, attributes suitable for primary keys, and commands for managing data. Additionally, it includes questions related to database design and SQL queries for data manipulation.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

A departmental store MyStore is considering to (d) Insert the following data into the attributes VisitorID,

maintain their inventory using SQL to store the data. As VisitorName and ContactNumber respectively in the
a database administer, Abhay has decided that : given table VISITOR.
• Name of the database - mystore VisitorID = “V004”, VisitorName= “VISHESH” and
• Name of the table - STORE ContactNumber= 9907607474
• The attributes of STORE a re as follows: (e) Remove the table VISITOR from the database HOTEL.
ItemNo – numeric Which command will he used from the following: a)
ItemName – character of size 20 DELETE FROM VISITOR; b) DROP TABLE VISITOR; c) DROP
Scode - numeric DATABASE HOTEL; d) DELETE VISITOR FROM HOTEL;
Quantity – numeric
An organization SoftSolutions is considering to
maintain their employees records using SQL to
store the data. As a database administer,
Murthy has
decided that :
• Name of the database - DATASOFT
• Name of the table – HRDATA
• The attributes of HRDATA are as follows:
ECode – Numeric
(a) Identify the attribute best suitable to be declared as a EName – character of size 30
primary key, Desig – Character of size 15
(b) Write the degree and cardinality of the table STORE Remn – numeric
(c) Insert the following data into the attributes ItemNo, Table: HRDATA
ItemName and SCode respectively in the given table
STORE. ItemNo = 2010, ItemName = “Note Book” and
Scode = 25
(d) Abhay want to remove the table STORE from the
database MyStore. Which command will he use from the
following:
i) DELETE FROM store;
ii) DROP TABLE store;
iii) DROP DATABASE mystore; a) Identify the attribute best suitable to be declared as a
iv) DELETE store FROM mystore; primary key.
(e) Now Abhay wants to display the structure of the table b) Write the degree and cardinality of the table HRDATA,
STORE, i.e, name of the attributes and their respective c) Write command to insert following data in the table:
data types that he has used in the table. Write the query ECode = 80015, Ename = “Allen” Remn = 43000
to display the same. d) Write SQL statement to delete the record of Jeevan
from the table HRDATA
e) Write SQL statement to increase the Remn of all the
employees by 10 percent.

(a) Write the name of most appropriate columns which


can be considered as Candidate keys?
(b) Out of selected candidate keys, which one will be the
best to choose as Primary Key?
(c) What is the degree and cardinality of the table?
A CD/DVD Shop named “NEW DIGITAL SHOP” stores (a) Identify the attribute best suitable to be declared as a
various CDs & DVDs of songs/albums/movies and use primary key,
SQL to maintain its records. As a Database Administrator, (b) If Administrator adds two more attributes in the table
you have decided the following MEDICINE then what will be the degree and cardinality
 Name of Database - CDSHOP of the table MEDICINE.
 Name of Relation - LIBRARY (c) Administrator wants to update the content of the
 Attributes are:- row whose ino is 1003 as , iname = “Paracetamol Tablet ”
(a) CDNO - Numeric values mcode = 25 and qty = 100
(b)NAME - Character values of size (25) (d) Administrator wants to remove the table MEDICINE
(c) QTY - Numeric values from the database medstore .
(d)PRICE - Decimal values Which command will he use from the following:
a) DELETE FROM store;
b) DROP TABLE MEDICINE;
c) DROP DATABASE medstore;
d) DELETE MEDICINE FROM medstore;
(e) Now Administrator wants to display only unique code
of the table MEDICINE . Write the query to display the
same
Answer the following questions based on the above table
LIBRARY:- ABC school is considering to maintain their student’s
(a) Write the Degree & Cardinality of the relation information using SQL to store the data. As a database
LIBRARY. administrator Harendra has decided that:
(b) Identify the best attribute which may be declared as Name of database : school
Primary key. Name of table : student
(c) Insert the following record in the above relation: Attributes of the table are as follow:
(10009, ”Motivational Songs”, 15, 70) AdmissionNo- numeric 4
(d) Write an SQL query to display the minimum quantity. FristName – character of size 30
(e) Database administrator wants to count the no. of LastName - character of size 20
CDs which does not have any Price value. Write the DOB - date
query for the same.

A Medical store “Lifeline” is planning to maintain their


inventory using SQL to store the data. A database
administer has decided that:
 Name of the database –medstore
 Name of the table –MEDICINE
 The column of MEDICINE table are as follows: (i) What is the degree and cardinality of the table
 ino - integer student
 iname – character of size 15 (ii) Identify the attribute best suitable to be declared as
 mcode - integer Primary Key
 qty – integer (iii) Insert the following data in table student
AdmissionNo=012368 FirstName = Kamlesh LastName =
Sharma DOB =01 Jan 2004
(iv) Harendra wants to remove the data of mukesh
whose admission no is 012358, suggest him SQL
command to remove the above said data.
(v) To remove the table student which command is used
i. Delete from student
ii. Drop table student
iii. Drop database school
iv. Delete student from school Fees – Numeric
Qtr – Numeric
A school KV is considering to maintain their eligible
students’ for scholarship’s data using SQL to store the Answer any four from the following questions:
data. As a database administer, Abhay has decided (i) Identify the attribute best suitable to be declared as a
that : • Name of the database – star primary key
• Name of the table - student (ii) Write the degree of the table.
• The attributes of student table as follows: (iii) Insert the following data into the attributes Rollno,
No. – numeric Name, Class, Fees and Qtr in fees table.
Name – character of size 20 (iv) Aman want to remove the table Fees table from the
Stipend - numeric database School. Which command will he use from the
Stream – character of size 20 following:
AvgMark – numeric a) DELETE FROM Fees;
Grade – character of size 1 b) DROP TABLE Fees;
Class – character of size 3 c) DROP DATABASE Fees;
d) DELETE Fees FROM Fees;
(v) Now Aman wants to display the structure of the
table Fees, i.e, name of the attributes and their
respective data types that he has used in the table. Write
the query to display the same

As a database administrator, answer any 4 of the


following questions:
Name of the table : SOFTDRINK
The attributes are as follows:
Drinkcode, Calories - Integer
Price – Decimal
Dname - Varchar of size 20

(A) Write query to create table.


(b) Which column is suitable to be a primary key
attribute.
(C) What is the degree and cardinality of table student.
(d) Display the details of student in ascending order of
name.
(e) Write query to change the grade of karan from ‘B’ to a) Identify the attributes that can be called Candidate
‘A’ 1 keys.
b) What is the cardinality and degree of the table
SOFTDRINK.
Modern Public School is maintaining fees records of c) Include the following data in the above table.
students. The database administrator Aman decided Drinkcode = 107, Dname = “Milkshake” and Calories =
that- 125
• Name of the database - School d) Give the command to remove all the records from the
• Name of the table – Fees table.
• The attributes of Fees are as follows: e) Write a query to create the above table with
Rollno - numeric Drinkcode
Name – character of size 20 as the Primary Key.
Class - character of size 20
Capacity - int
Charges – int

A department is considering to maintain their worker


data using SQL to store the data. As a database
administer, Karan has decided that :
Name of the database - Department
Name of the table – WORKER (i) Identify the attribute best suitable to be declared as a
The attributes of WORKER are as follows: primary key
WORKER_ID - character of size 3 Ans:- vcode
FIRST_NAME – character of size 10 (ii) Write the degree and cardinality of the table
LAST_NAME– character of size 10 CABHUB. Ans:- Cardinality:-5 Degree:-6
SALARY - numeric (iii) To display name of vehicle, make and capacity of
JOINING_DATE – Date vehicle in descending order of their seating capacity.
DEPARTMENT – character of size 10 Ans:- Select v_name,make,capacity from CABHUB
ORDER BY capacity desc;
(iv) To display the name of vehicle where make contain
‘ta’. 1
Ans:- select v_name from cabhub where make like '%ta
%';
(v) To display the names of all the vehicles having
a) Write a query to create the given table WORKER. charges between 15 and 40
b) Identify the attribute best suitable to be declared as a Ans:-
primary key. select v_name from cabhub where charges between 15
c) Karan wants to increase the size of the FIRST_NAME and 40;
column from 10 to 20 characters. Write an appropriate OR
query to change the size. select v_name from cabhub where charges>=15 and
d) Karan wants to remove all the data from table charges<=40
WORKER from the database Department. Which
command will he use from the following:
i) DELETE FROM WORKER;
ii) DROP TABLE WORKER;
iii) DROP DATABASE Department;
iv) DELETE * FROM WORKER;
e) Write a query to display the Structure of the table
WORKER, i.e. name of the attribute and their respective
data types.

A car company XYZ is considering to maintain their


inventory using SQL to store the data. As a database
administer, Himanshu Rana has decided that :
• Name of the database – aman
• Name of the table - CABHUB
• The attributes of CABHUB are as follows:
vcode - int
v_name – character of size 50
make – character of size 20
color – character of size 10

You might also like