Chapter 2 Introduction to DBMS
1. Complete the following activity.
Question 1.
Tick whichever box is not valid.
Answer:
Question 2.
The student wants to create a field Pincode in a table, which data type he will choose?
Answer:
Int
Question 3.
Tick the appropriate box.
Answer:
Uniquely identifies a record
Question 4.
Tick the appropriate circle.
Answer:
One or Many Tables
2. Observe the field names of a database given below in ‘Column A’ related to Bus reservation. Write suitable data types for each field in front of the respective field in ‘Column B’.
Question 1.
Answer:
Column A (Field Name) | Column B (DataType) |
Passenger Name | Varchar |
Age | Int |
Gender | Char |
Mobile Number | Int |
3. Write the use of the following SQL command.
Question 1.
Answer:
4. Create a table for the information given below by choosing appropriate data types. Specify proper primary key for the table (1) Movie (2) Actor
Question 1.
Movie (Registeration_no, movie_name, Realease_Date)
Answer:
CREATE TABLE Movie (Registeration_no int(20) PRIMARY KEY, movie_name VARCHAR(20), Realease_Date DATE);
Question 2.
Actor (actor_id, Actor_name, birth_date )
Answer:
CREATE TABLE Actor (actor_id int(20) PRIMARY KEY, Actor_name VARCHAR(20), Birth_Date DATE);
5. Consider the following table Stationary. Write SQL commands for the following statements.
Table: Stationary
Question 1.
Write SQL command to create above Table.
Answer:
CREATE TABLE Stationary (S_ID int(20) PRIMARY KEY, S_Name VARCHAR(20), C_Name VARCHAR(20), Price int(20), Quantity int(20));
Question 2.
Write SQL command to insert the above-mentioned record in the table.
Answer:
INSERT INTO Stationary Values (001, ‘Note Book’, ‘ABC’, 20,50);
INSERT INTO Stationary Values (002, ‘Note Book’, ‘XYZ’, 10,80);
INSERT INTO Stationary Values (003, ‘Note Book’, ‘PQR’, 600,02);
Question 3.
To delete the above table.
Answer:
DROP TABLE Stationery;
6. Answer the following questions.
Question 1.
What is a database?
Answer:
A DBMS is a collection of programs (computer-based system) that enables the user to create and maintain a database it is used to define, construct and manipulate the data in the database for various applications. It provides information storage, organization, and retrieval capabilities. The DBMS also enforces necessary access restrictions and security measures in order to protect the database.
Various types of control systems within the DBMS make sure that the database continues to function properly. They Include Integrity system Security system Concurrency control system Recovery control system Some DBMS enables us to define “views” of the database. A view is how the database appears to the user. This enables us to show only the relevant information to different types of users and it increases security, as certain users will not be able to see data which they are not meant to see.
Question 2.
What are the advantages of a DBMS?
Answer:
Advantages of a DBMS:
1. Redundancy is controlled: In File Processing System, duplicate data is created in many places because all the programs have their own files. This creates data redundancy which in turn wastes labor and space. ‘In Database Management System, all the files are integrated into a single database. The whole data is stored only once in a single place so there is no chance of duplicate data.
2. Sharing of Data: In a database, the users of the database can share the data among themselves. There are various levels of authorization to access the data. And consequently, the data can only be shared based on the correct authorization protocols being followed.
3. Data Security: Data Security is a vital concept in a database. Only authorized users should be allowed to access the database and their identity should be authenticated using a username and password. Unauthorized users should not be allowed to access the database under any circumstances as it violates the integrity constraints.
4. Enforces integrity constraints: Constraints are used to store accurate data because there are many users who feed data in the database. Data stored in the database should always be correct and accurate. DBMS provides the capability to enforce these constraints on the database.
5. Provides backup and recovery of data: Data loss is a very big problem for all organizations. In a traditional tile processing system, a user needs to back up the database after a regular interval of time that wastes lots of time and resources. If the volume of data is large then this process may take a very long time.
Question 3.
What do you understand by Data Model?
Answer:
A Database model defines the logical design and structure of a database and defines how data will be stored, accessed, and updated in a database management system. While the Relational Model is the most widely used database model.
Relational Model:
It is the most popular data model in DBMS. The relational model is the primary data model. Which is widely used for data processing. This model has all properties required to Process data with storage efficiency.
Question 4.
What is a primary key?
Answer:
Primary Key: A column in the table that uniquely identifies each row in that table is called a primary key.
Question 5.
What is DDL (Data Definition Language)
Answer:
DDL statements or commands are used to define and modify the database structure of your tables or schema. When you execute a DDL statement, it takes effect immediately.
Some examples of DDL commands are CREATE, ALTER, and DROP.
7. In a company the data is stored in a table under the following fields Employee number, Last name, Date of birth, Address. Which data type will you use for the above field?
Question 1.
Answer:
Field Name | Data Type |
Employee Name | Char |
Last Name | Char |
Address | Varchar |
Date of Birth | Date |
8. Multiple choice select three correct answers.
Question 1.
Valid relationships in RDBMS are
(a) one to one
(b) one to two
(c) one to many
(d) many to two
(e) many to many
(f) one to three
Answer:
(a) one to one, (c) one to many, (e) many to many
9. Complete the following.
Question 1.
Answer:
Use | Command |
To remove access rights or privileges from the database | Revoke |
Extracts data from a table | Insert into Select |