You are on page 1of 6

GBSSS, New Seemapuri

Information Technology, Class 11

RDBMS & MySQL

___________________________________________________________
Database Management System (DBMS)

A database management system, often known as a DBMS, is required to develop


and maintain databases on computers. Users can develop and administer databases using
software called a database management system. MySQL, PostgreSQL, Microsoft Access,
Oracle, Microsoft SQL Server, DB2, and Sybase are some of the well-known DBMSs.

DBMS allow us to (Features of DBMS):

· store data in a structured way.

· query the database (that is, ask questions about the data)

· sort and manipulate the data in the database

· validate the data entered and check for inconsistencies

· produce flexible reports, both on screen and on paper, that make it easy to comprehend
theninformation stored in the database.

Relational Database

The term “relational database” refers to a database that contains data in several tables that
are connected by a common column is known as Relational Database.

a. Redundancy can be controlled

b. Inconsistence can be avoided

c. Data can be shared

d. Security restrictions can be applied.

RDBMS Terminology

1
Domain

It is pool of values or the collection (set) of possible values from which the value for a
column is derived.

Tables or Relation in a Database

Relational Databases store data or information in tables. A table is similar to a spreadsheet


where data is stored in rows and columns. We can interlink or we can make the relation
between the table using a common field.

Record – A record in a database is a collection of fields within a table that are relevant to
one particular entity. This record is also called row or tuple.

Field – The term field is also refer as a column. Each column has a unique name and the
content within it must be of the same type. Field is also known as Column and Attribute.

MySQL – It is an Open Source RDBMS Software. It is available free of cost.

Key – A key is an attribute or group of attributes that aids in uniquely identifying a row (or
tuple) in a table (or relation). When we want to create connections between the various
columns and tables in a relational database, we also employ a key.

Types of Keys in DBMS

There is a 7 different types of keys, but in your syllabus only 4 keys are given we are going to
discusses based on these four key only.

Primary Key – The group of one or more columns 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 a
relation is called a Candidate key because it is one of the candidates available to be the
primary key of the relation.

Alternate Key – A candidate key of a table which is not selected as the primary key is called
its Alternate Key.

Foreign Key – A primary key of a base table when used in some other table is called as
Foriegn Key.

Characteristics of MySQL-

a. It requires no cost or payment for its usage.

2
b. MySQL has superior speed, is easy to use and is reliable.

c. MySQL uses a standard form of the well-known ANSI-SQL standards.

d. MySQL is a platform independent application which works on many operating systems


like Windows, UNIX, LINUX etc. and has compatibility with many languages including JAVA ,
C++, PHP, PERL, etc.

e. MySQL is an easy to install RDBMS and is capable of handling large data sets.

Categories of SQL Commands

SQL commands can be classified into the following categories:

1. Data Definition Language (DDL)

2. Data Manipulation Language (DML)

Data Definition Language (DDL)

The DDL part of SQL permits database tables to be created or deleted. It also defines indices
(keys), specifies links between tables, and imposes constraints on tables.

Examples of DDL commands in SQL are:

1. CREATE DATABASE – creates a new database

2. CREATE TABLE – creates a new table

3. ALTER TABLE – modifies a table

4. DROP TABLE – deletes a table

Data Manipulation Language (DML)

The query and update commands form the DML part of SQL: Examples of DDL commands
are:

1. SELECT – extracts data from a table

2. UPDATE – updates data in a table

3. DELETE – deletes data from a table

4. INSERT INTO – inserts new data into a table

3
MySQL Data Types

Data types can be broadly classified into following categories:-

1. Numeric Types

2. Alphanumeric Types

3. Date Time

Numeric Types

They are used for describing numeric values like mobile number, age, etc.

a) Decimal – Decimal Data type represent decimal number and store the decimal
values in database.

b) Integer – Integer Data type is used for storing integer values.

Alphanumeric Types

Alphanumeric data types are used to store character values in the database like student
name, address etc.

a) Char(size) – A fixed-length string from 1 to 255 characters in length right-padded


with spaces to the specified length when stored. Values must be enclosed in single
quotes or double quotes

b) Varchar(size) – A variable-length string from 1 to 255 characters in length; i.e.


VARCHAR(25). Values must be enclosed in single quotes or double quotes.

Date Time Types

When specifying date and time values for a column used in a database table, date time data
types are utilised. Information like a person’s date of birth, admission date, and so on might
be stored on it.

a) Date (Stores month, day and year information)

b) Time (Store hour , minute and second information)

EXERCISE
1. Write a short note on MySQL.
2. Mention features of a DBMS.
3. List some features of MySQL.
4. How is Primary Key different from Candidate Key?
5. Define the key(s) used in MySQL.
6. Which statement is used to select a database and make it current?

4
7. Do Primary Key column(s) of a table accept NULL values?

8. Which statement is used to modify data in a table?

A. CHANGE
B. MODIFY
C. UPDATE
D. SAVE AS
9. Which SQL statement is used to delete data from a table?
A. DELETE
B. DROP
C. TRUNCATE
D. REMOVE

10. Fill up the blanks :


1, ______________ command is used to add records in a relation.
2. Select is a type of ___________ command.
3. _________ command is used to modify records in a table.
4. _________ is used to match string patterns.
5. BETWEEN operator includes __________ and _____________ values given in the
range.

12. Answer the following questions on the basis of given table.

5
a. How many attributes are there in above table?
b. How many tuples are there in above table?
c. What is the degree of above table?
d. What is the Cardinality of this table?

13. Consider the given description of a "Student" table.

a. Write the command to create the above table.


b. Write query to insert the following record
Roll No - 1 , Name - Amit Kumar, Phone No - 9876543210
c. Write query to insert the following values only.
Roll No - 2, Name - Aman
d. Write query to insert phone no 8967564534 for Roll No 2.
e. Write query to delete record for Roll no 1.
f. Write query to delete the table.

You might also like