Chapter 2 Introduction to RDBMS—MySQL
D. Answer the following.
1. What is an RDBMS? Give two real-life applications of RDBMS.
Ans:- An RDBMS (Relational Database Management System) is
software that stores data in related tables. It uses SQL for managing,
updating, and retrieving structured data efficiently and securely.
Real Life Applications of a Relational Database
1. Government Records.
2. Banking and Finance.
2. Briefly explain the data types and constraints used in MySQL.
Ans:-
Data Types: sed to define the kind of data a column can store.
INT – Stores numbers with Integer values
FLOAT– Stores numbers with decimal values.
CHAR(n) – Character data type. ‘n’ represents length from 0 to
[Link] fixed-length text.
VARCHAR(n) – Character data type of length n. ‘n’ can be any
value from 0 to 65,535. However, the size is variable,
DATE – Used to store dates in the YYYY-MM-DD format.
Constraints: Rules applied to table columns to ensure data accuracy
and integrity.
PRIMARY KEY – Uniquely identifies each row; cannot be
NULL.
FOREIGN KEY – Links one table to another.
NOT NULL – Column must have a value.
UNIQUE – All values in the column must be different.
DEFAULT – Sets a default value if none is given.
3. In your own words, describe why WHERE condition is necessary
with UPDATE statement.
Ans:- To update data stored in a table, the UPDATE statement is
used. if you do not add WHERE condition, the entire column will be
updated to the new value.
4. Write short notes on the following terms:
a. Types of keys b. DDL c. SQL
Ans:-
a. Types of Keys
Primary Key: Uniquely identifies each record; no duplicates or
nulls.
Foreign Key: Links one table to another using a primary key.
Candidate Key: All unique columns that can be primary keys.
Composite Key: Uses two or more columns together to identify
records uniquely.
b. SQL (Structured Query Language):
SQL is a language used to create, manage, and work with databases.
It lets you create tables, store data, and retrieve or change information
in a database.
c. DDL (Data Definition Language):
DDL is a subset of SQL used to define the structure of the database
— like creating or changing tables.
5. What do you understand by a Database? Describe the advantages of
a DBMS in brief.
Ans:- A database is a collection of organised data stored
electronically in a computer system. A database helps you to store and
retrieve data easily.
Advantages of DBMS
Organized Storage: Data stored in tables (rows and columns).
Easy Retrieval: Quick and simple data access.
Data Updation: Add, update, and delete data easily.
Security: Protects data from unauthorized access.
Integrity: Keeps data accurate and consistent.
E. Application based questions.
1. Kartik’s teacher told him to create a table in SQL, but he was
unable to create it. He was using the Create statement as follows:
CREATE STUDENT. What was his mistake?
Ans:- Kartik missed using the keyword TABLE and did not define the
columns.
2. Rita’s teacher asked her to state the name of the data type that
stores her birthday. She answered correctly. What do you think she
answered?
Ans:- DATE data type.
F. Competency based questions.
1. Assume you are creating and updating a database in SQL. What
rules will you follow to do so?
Ans:- following are the few rules:-
a) Use correct SQL syntax.
b) End each statement with a semicolon (;).
c) Use proper data types, etc.
2. Suppose, your brother needs to create a table in SQL, but he forgot
the steps to do so. Prepare a step by-step guide to help him.
Ans:-
CREATE TABLE TableName (
Column1 DataType,
Column2 DataType,
...
);