0% found this document useful (0 votes)
96 views6 pages

DBMS

Uploaded by

SHASHANK RAJPUT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views6 pages

DBMS

Uploaded by

SHASHANK RAJPUT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DATABASE MANAGEMENT SYSTEM

Database: A database is an organised collection of data.


DBMS:A collection of programs that enables you to store, modify and extract information from a database.
Relational Database: A database in which the data is stored in the form of relations(also called tables) is called
a Relational Database.
RDBMS: A DBMS used to manage Relational Databases is called an RDBMS(Relational DabaBase
Management System). Some popular RDBMS software available are Oracle, MySQL, Sybase, Ingress.
Relation: A relation is two dimension table.
Attributes. The column of the table are called attributes
Tuples: The rows of the table are called tuples.
Degree: The number of attributes in a relation is called the degree of the relation.
Cardinality: The number of tuples(rows) in the relation is called its cardinality.
Primary Key: The group of one or more column used to uniquely identify each row of a relation is called its
Primary Key.
Candidate Key: A column or a group of columns which can be used as the primary key of relation is called a
candidate key.
Alternate key: A candidate key of table which is not made its primary key is called its Alternate key.
Foreign Key: A foreign key is a column in a table where that column is a primary key of another table.
Categories of SQL:
(i) DDL(Data Definition Language): This is the category of SQL commands. All the commands which
are used to create, destory or resturcture databases and tables come under this category. Examples of DDL
commands are -CREATE, DROP, ALTER.
(ii) DML(Data Manipulation Language): This is a category of SQL Command. All the commands which are
used to manipulae data within tables comes under this category. Examples: Insert,Update,Delete.
(iii)DCL(Data Control Language): All the commands which are used to control the access to databases and
tables fall under this category. Examples -Grant, Revoke.
Benefits of using a DBMS are: Redundancy can be controlled, Inconsistence can be avoided, Data can be
shared, Security restrictions can be applied.
1.Write two examples of DBMS software.
Ans : MySQL, Oracle,Sybase,Ingress,PostreSQL, Microsoft Access, SQL Server.

2. What is MySQL
Ans: MySQL is an open Source Relational Database Mangement System(RDBMS) that uses structured Query
Language(SQL) for adding, accessing and managing content in a database. It is an open source RDBMS software.
It is available free of cost.

3. What is Primary Key? Explain 1[comptt 2020]


Ans: A Primary Key is an attribute of a Table which has a unique value for each of the records and can be used
to identify a record of the table.

4, Give two characteristics of Primary Key.


Ans: (i)It must contain a unique value for each row of data
(ii)It cannot contain null values.

5. How is primary key constraint different from Unique key constraint?


Ans: In a table, there is only one primary key constraint whereas, it may have more than one unique key con-
straint.

6. Differentiate between the Primary key and Alternate key of a table with the help of an example
[ Compt 13]
OR
Q What is an Alternate Key?[ D 06]
Ans:A primary key is a column (or columns) in a table that uniquely identifies the rows in that table.
The values placed in primary key columns must be unique for each row: no duplicates can be tolerated. In
addition, nulls are not allowed in primary key columns.
EMP table
empno Phone Name
1 9810189864 Rajan
2 8764321056 Aman
3 9899234221 Rajesh
4 9089422451 Aman
Here in Emp table you can choose either Empno or phone columns as primary key, Empno is preferable choice.
Candidate column other the Primary column is called alternate key, like if Empno is PK then Phone would be
the Alternate key.
7. What are candidate keys in a table? Give a suitable example of candidate keys in a table. [D 09,SP 21]
Ans : A column or a group of columns which can be serve as the primary key of relation is called a candidate
key.
for ex; EMP table
empno Phone Name
1 9810189864 Rajan
2 8764321056 Aman
3 9899234221 Rajesh
4 9089422451 Aman
Here in Emp table you can choose either Empno or phone columns as primary key, So empno and phone would
be the candidate keys.
8. Differentiate between Primary key and Candidate key. [SP 2019-20]
Ans. A Candidate Key can be any column or a combination of columns that can qualify as unique key in
database. There can be multiple Candidate Keys in one table where as a Primary Key is a column or a
combination of columns that uniquely identify a record. Only one Candidate Key can be Primary Key.
9. Observe the following tables carefully and answer the questions that follow: 2[2019]
TABLE:FARMER
FNO NAME
101 Ramya Sarkar
102 Ram Dhyan
103 Gagan Hari
104 Ram Dhyan
Which attribute out of the two attributes FNO and NAME in table FARMER should be considered as Primary
Key? Give reason for your selection of the same.
Ans Primary Key: FNO
Reason: Unique values for identification of each tuple/record

10 Observe the following table carefully and write the names of the most appropriate columns, which can be
considered as (i) candidate keys and (ii) primary key. [2015 D]

Id Product Qty Price Transaction Date


101 Plastic Folder 12” 100 3400 2014-12-14
104 Pen Stand Standard 200 4500 2015-01-31
105 Stapler Medium 250 1200 2015-02-28
109 Punching Machine Big 200 1400 2015-03-12
103 Stapler Mini 100 1500 2015-02-02

11 Observe the following table carefully and write the names of the most appropriate columns, which can be
considered as [2015 OD]
(i) candidate keys and (ii) primary key.

Code Item Qty Price TransactionDate


1001 Plastic Folder 14” 100 3400 2014-12-14
1004 Pen Stand Standard 200 4500 2015-01-31
1005 Stapler Mini 250 1200 2015-02-28
1009 Punching Machine Small 200 1400 2015-03-12
1003 Stapler Big 100 1500 2015-02-02

12. Differentiate between DDL & DMLcommands. Identify DDL & DML commands from the following:-
(UPDATE, SELECT, ALTER, DROP) [SP 18]
Ans DDL stands for Data Definition language and comprises of commands which will change the structure of
database object. DML stands for Data Manipulation Language and comprises of commands which are used to
insert, edit, view & delete the data stored in a database object.
DDL Commands: ALTER, DROP DML Commands: UPDATE, SELECT
13. Write the full forms of DDL and DML. Write any two commands of DML in SQL [comptt 2020]
Ans :DDL – Data Definition Language
DML – Data Manipulation Language
Any two out of INSERT, DELETE, UPDATE

14 What is the difference between degree and cardinality of a table ? What is the degree and cardinality of the
following table ? [D 13]

Eno Name Salary


101 John Fedrick 45000
103 Raya Mazumdar 50600
15 Based upon given table write degree and cardinality. [SP 14]
PATENTS

PatNo PatName Dept DocID


1 Leena ENT 100
2 Surpreeth Ortho 200
3 Madhu ENT 100
4 Neha ENT 100
5 Deepak Ortho 200
16 Observe the following tables, EMPLOYEES and DEPARTMENT carefully and answer the questions that
follow: 2[comptt 2020]
Table: EMPLOYEES
ENO ENAME DOJ DNO
E1 NUSAT 2001-11-21 D3
E2 KABIR 2005-10-25 D1

Table: Department
DNO DNAME
D1 ACCOUNTS
D2 HR
D3 ADMIN
What is the Degree of table EMPLOYEE? What is the cardinality of table Department?

17. Consider the table, MOVIEDETAILS given below: [SP 2021-22 Term2]
Table: MOVIEDETAILS
MOVIEID TITLE LANGUAGE RATING PLATFORM
M001 Minari Korean 5 Netflix
M004 MGR Magan Tamil 4 Hotstar
M010 Kaagaz Hindi 3 Zee5
M011 Harry Potter and the Chamber of Secrets English 4 Prime Video
M015 Uri Hindi 5 Zee5
M020 Avengers: Endgame English 4 Hotstar
(a) Identify the degree and cardinality of the table.
(b) Which field should be made the primary key? Justify your answer.
(c) Identify the candidate key(s) from the table MOVIEDETAILS.
(d) Consider the table SCHEDULE given below:
Table: SCHEDULE
SLOTID MOVIEID TIMESLOT
S001 M010 10 AM to 12 PM
S002 M020 2 PM to 5 PM
S003 M010 6 PM to 8 PM
S004 M011 9 PM to 11 PM
Which field will be considered as the foreign key if the tables MOVIEDETAILS and SCHEDULE are related in
a database?

18. Categorize following commands into DDL and DML commands? [SP 2021-22 Term2]
INSERT INTO, DROP TABLE, ALTER TABLE, UPDATE...SET

19.Observe the following table and answer the parts (i) and (ii): [2014 compt]
Table : STORE
ITEM CODE ITEM QTY. RATE
10 Get pen classic 1150 25
11 Sharpener 1500 10
12 Ball pen 0.5 1600 12
13 Eraser 1600 5
14 Ball pen 0.25 800 20
(i) In the above table , can we have qty as primary key. Justify your answer.
(ii) What is the cardinality and degree of the above table?

20. Observe the following table STOCK carefully and answer the questions that follow : 2[comptt 2019]
Table : STOCK
SNO NAME PRICE
101 PEN 50
102 PENCIL 5
103 PENCIL 10
104 NOTEBOOK 50
105 ERASER 5
Which attribute out of SNO, NAME and PRICE is the ideal one for being considered as the Primary Key and
why ?

21.Which of the following clauses in SQL is most appropriate to use to select matching tuples in a specific
range of values ? 1[comptt 21]
(A) IN (B) LIKE (C) BETWEEN (D) IS

22.Which of the following is not a valid datatype in SQL ? 1[comptt 21]


(A) DATE (B) STRING (C) DECIMAL (D) CHAR
23 Which of the following is not a valid DML command in SQL ? 1[comptt 21]
(A) INSERT (B) UPDATE (C) ALTER (D) DELETE

24. Which of the following commands in SQL is used to add a new record into a table ? 1
(A) ADD (B) INSERT (C) UPDATE (D) NEW

25. Which of the following is the correct expansion of DML in context of SQL ? 1
(A) Direct Machine Language (B) Data Mixing Language
(C) Distributed Machine Language (D) Data Manipulation Language

26.What are Tuples in a SQL Table ? Write a suitable example with a SQL Table to illustrate your answer.
[comptt 21]

27.Write the names of any two constraints and their respective uses in SQL. 2[comptt 21]

28. Observe the following table FOOD carefully and answer the questions that follow : 2[Comptt 21]
TABLE:FOOD
AVGPRICE FNAME FNO ORIGIN
75 DOSA F01 SOUTH INDIA
100 BURGER F03 AMERICAN
45 VADA PAV F04 MAHARASHTRA
70 CHOW MEIN F09 CHINA
70 CHOLE BHATURE F15 PUNJAB
80 SARSON KA SAAG F12 RAJASTHAN
25 MAKKI KI ROTI F 11 RAJASTHAN
(i) What is the Degree and Cardinality of table FOOD ?
(ii) Which attribute out of AVGPRICE, FNAME, FNO and ORIGIN of table FOOD is the ideal one for being
considered as the Primary Key and why ?

You might also like