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

RDBMS Concepts and MySQL Overview

The document discusses database management systems and relational database concepts like tables, keys, SQL commands and MySQL. It provides explanations of various DBMS terms and features of MySQL. Several exercises related to creating and manipulating database tables using SQL commands are also given.
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)
532 views6 pages

RDBMS Concepts and MySQL Overview

The document discusses database management systems and relational database concepts like tables, keys, SQL commands and MySQL. It provides explanations of various DBMS terms and features of MySQL. Several exercises related to creating and manipulating database tables using SQL commands are also given.
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

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.

Common questions

Powered by AI

MySQL being open-source means it is freely available, reducing the cost for organizations to manage their databases. Its platform independence enables deployment across various operating systems, providing flexibility for organizations to implement the database system in diverse IT environments. This adaptability and cost-effectiveness make MySQL an attractive option for organizations with varied infrastructure needs .

MySQL ensures data integrity and consistency through several mechanisms such as enforcing constraints like Primary Keys, Foreign Keys, and unique constraints. Additionally, MySQL adheres to ACID properties (Atomicity, Consistency, Isolation, Durability) which guarantee that all database transactions are processed reliably .

A Primary Key is a specific choice from the set of Candidate Keys and is used to uniquely identify each tuple in a table. While a Candidate Key also can uniquely identify tuples, it is essentially a potential choice for a primary key but is not necessarily selected as the primary key. Moreover, only one Primary Key is chosen, whereas there can be multiple Candidate Keys for a table .

MySQL is known for its superior speed, reliability, and ease of use. It supports platform independence and compatibility with languages such as Java, C++, PHP, and PERL, which increases its adaptability across various operating environments. These capabilities make MySQL a preferred choice for applications that require efficient data handling and seamless integration with existing systems .

Attributes, also known as fields or columns, are the properties or characteristics of the data in a table, defining the type of data each column can hold. Tuples, or records, represent individual entries in a table, with each tuple containing values for each attribute. Together, they define the structure and organization of data within a relational database, contributing to its complexity and capability to store multi-dimensional data .

CHAR is a fixed-length string type, right-padded with spaces to the defined length limit, making it suitable for data entries with a predictable, consistent size. VARCHAR is a variable-length string type, capable of storing longer strings, and is more efficient with storage for data with variable sizes. CHAR is preferable for fields like state codes or fixed IDs, while VARCHAR is suitable for names or descriptions .

Modifying a table schema, such as adding, modifying, or deleting columns, impacts data retrieval and integrity by potentially altering the relationships between tables and constraints (like foreign keys), which are vital for maintaining referential integrity. It can lead to changes or errors in data retrieval if queries are not updated to reflect the new schema structure. Careful schema management is crucial for consistent data integrity and efficient querying .

DDL commands, such as CREATE DATABASE, CREATE TABLE, ALTER TABLE, and DROP TABLE, allow for the creation, alteration, and deletion of database structures like tables and indices. In contrast, DML commands like SELECT, UPDATE, DELETE, and INSERT INTO are used for querying and modifying the data within the tables. DDL affects the database schema while DML affects the data itself .

A Foreign Key is a primary key from one table used in another table to establish a link between the two tables. This helps maintain referential integrity by ensuring that there is a valid connection between the keys in different tables. It allows for the enforcement of cascading updates and deletions, preserving relationship consistency across tables .

The Domain concept in RDBMS defines a permissible set of values for a given column, contributing to data validation and integrity by restricting the data that can be input into a column to a specific set of valid values. This ensures uniformity and consistency in the data entries across the database, aiding in maintaining data quality .

You might also like