0% found this document useful (0 votes)
60 views10 pages

Unit-3 IP Notes

The document provides an overview of database concepts using SQL, including definitions of data, databases, and DBMS. It explains the importance of databases, types of database management systems, and the relational database model, along with SQL commands for database manipulation. Additionally, it covers various SQL command types such as DDL, DQL, DML, DCL, and TCL, along with examples of MySQL commands.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views10 pages

Unit-3 IP Notes

The document provides an overview of database concepts using SQL, including definitions of data, databases, and DBMS. It explains the importance of databases, types of database management systems, and the relational database model, along with SQL commands for database manipulation. Additionally, it covers various SQL command types such as DDL, DQL, DML, DCL, and TCL, along with examples of MySQL commands.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

INFORMATICS PRACTICES

IP-065

IP NOTES
UNIT-3
DATABASE CONCEPT USING SQL

GRADE-11
SESSION 2025-26

Submitted By: Submitted to:


CHAPTER – 3

DATABASE CONCEPT USING SQL


 DATA
Data is a raw fact or unprocessed information.

Or

Data is a collection of raw facts like text, figures, observations , that can interpreted and
processed to gave meaningful insights. Raw facts like : number, text, images, sound,
animations, symbol, or any structured or instructed formats.

 DATABASE
A database is a collection of data or information that is arranged in the organised way so
that it can easily accessed, managed, stored and updated.

In the database, data is organised into rows and columns & tables.

Database is indexed to make it easier to find relevant information.

Database is just like a container which contains the various objects like table, queries,
reports [Link] organised way

 Why do we need database


Accuracy

Security of data

Data integrity

To manage large amount of data

Easy to update data

 DBMS
DBMS stands for Data Management System.

A DBMS refers to a software that is responsible for storing, maintaining and utilizing
database in an effective and efficient way.

A database along DBMS software Is called database system.

Example of DBMS – following are the some main example of DBMS

MS Access
MySQL

Paradox

DB – 2

Oracle

MS SQL server

Advantages of DBMS/Database
1) database ensure security or protect

tion against unauthorized modification or any intentional disclosure

2) database maintains integrity.

3)database reduces redundancy/ duplicity

4) database controls inconsistency.

5) database facilitates sharing of data.

 RDBMS
 DATA MODEL
Data mode is a model or presentation which shows how data is organised ? or stored data in
the database.

A data is modelled by one of the following data model

1) rational data model

2) network data model

3) hierarchical data model

4) object oriented data model

 RATIONAL DATA MODEL


A rational data model into relations or table i.e. rows & columns.

A row in a table represent a relationship of a data to each other or also called a tuple or
record.

In a table the column represents called a attribute or field.

RDMS

RDMS stands for the Relational Database Management.

A relational database is a collective set of multiple data, organised by tables, records and
columns.
Relational database established a well define relationship database tables.

Tables communicates and share information which facilitates data search ability, organised and
reporting.

A relational database use SQL(Structured Query Language), which is a standard


user application that provides an easy programming interface for database interactions.

 RDBMS Terms
 Database relational ( table)
A relational table is a matrix like structure arrange in rows and columns.

The relational / table as the following properties :

1) Atomicity

2) No duplicity

3) Homogenous column

4) Ordering of rows & column is immaterial.

 DOMAIN.
It is the collection of values from which the value derive for a column.

TUPLE/ RECORD/ ENTITY

Rows of table is called tuple/record / entity

FIELD/ ATTRIBUTE

Column of a table is called attribute/ field.

 DEGREE
No. of column or attributes In a table is called Degree.

 CARDINIALITY
No. of rows or record In a table is called Cardinality

 KEYS IN A DATABASE
 KEY: a key an important role in relational database. It is used for identifying unique
rows from table and establishes relationship among the table on demand.

TYPES OF KEYS IN DBMS


There are many types of keys in DBMS are as follows –

Primary key

Candidate key
Alternate key

Foreign key

Unique key

Composite key

Super key

 PRIMARY KEY
A primary key is a column or set of column in a table that uniquely identifies rows (tuple) in
that table.

 Alternate key
Out of all candidate keys plays only one key get selected as a primary key remaining other
keys are known as alternate key or a secondary key.

 Candidate key
It is an attribute or a set of attribute that participates for a primary key certain process and
to uniquely identify each other record in that table.

 SQL (Structured Query Language)


SQL stands for Structured Query Language.

It is a standard language developed and used for accessing and modifying relational
database.

The SQL Language was originally developed at IBM’s research laboratory California,
USA, connection with a project a develop prototype for a relational, database
management system called System R in 1970’s.

Examples of SQL –

SQL is being used by many database management system . Some of them are –

My SQL

SQLite

Postgre SQL

Oracle

Microsoft SQL server

ADAVANTAGES OF SQL –
Following are the same main advantages of using SQL –
Portability

High speed

No proper coding needed ( only small statement )

Well defined language

Interactive language

Multiple data view

 My SQL
My SQL is currently the most popular open source database software. It is a multi-
user, management system.

My SQL is especially popular on the web world.

It is one of the part of very popular LAMP – platform. Like –Linux, Apache , My SQL,
PHP are the LAMP platform.

My SQL was founded by Michael Widens, David A-Mark and Allen Larnusan in
Sweden in 1995.

FEATURES OF MY SQL –
Following are the very important features of My SQL –

Portability

Security

Connectivity

Open – source and free of cost

Query language

TYPES OF SQL COMMAND –


Following are the some important command of SQL –

DDL( Data Definition language )

DQL (Data Query Language )

DML ( Data Manipulation Language )

DCL ( Data Control Language )

TCL ( Transactional control Language )

 DDL
DDL stands for Data Definition Language.

DDL create database and table structure command .

OR

DDL is a set of SQL are commands used to create user, who should be accessing the
database by an application.

LIST OF DDL COMMAND –

CREATE

DROP

ALTER

TRUNCATE

COMMENT

RENAME

 DQL
DQL stand for Data Query Language.

DQL command is used to retrieve the data from database.

OR

DQL command is a component of SQL statement that allows getting data from
database and imposing order upon it.

The purpose of the DQL command is to get some scheme a relation based on a
query.

LIST OF DQL COMMAND –

SELECT

 DML
DML stands for Data Manipulation Language.

DML command is used on the rows / records related to operations.

OR

The DML command deal with the manipulation of data present in the database.

DML command includes most of the SQL statements.

LIST OF DML COMMANDS –

INSERT
DELETE

UPDATE

LOCK

CALL

 DCL
DCL stands for Data Control Language

DCL command is used to manipulate permission or access write to the tables.

LIST OF DCL COMMANDS –

GRANT

REVOKE

 TCL
TCL stands for Transactional Control Language.

TCL command is used to control the transactions of data/ database.

OR

TCL command are used to control the education of transaction.

LIST OF TCL COMMAND –

COMMIT

ROLLBACK

SAVE POINT

 DATABASE COMMAND IN MY SOL


 Creating a Database
My SQL > CREATE database My SQL;

 DELETE a database
My SQL > DROP database My SQL;

 SHOW Database or Table


My SQL> SHOW database My SQL;

My SQL> SHOW Table T_Name;

 REMOVE or DELETE TABLE


My SQL> DROP Table T_Name;

 CREATE A DATA IN DATABASE WITH USE STATEMENT


My SQL > USE MYSQL;

 CREATE A TABLE IN THE DATABASE IN ARCIEVED WITH CREATE


TABLE STATEMENT
My SQL > CREATE TABLE Student ( student_name )

Varchar command (25 ) , FRAME vachar(25), class char(4);

 VIEW THE TABLE STRUCTURE (DESCRIBE) –


The DESCRIBE command is used to view structure of table.

My SQL>DESCRIBE Student;

 INSERT NEW ROW IN A TABLE –


To insert a new into existing table with the help of INSERT command

My SQL> INSERT INTO Student value (‘ Adarsh ’, ‘ Deepak _Gupta’_, 11 A);

Similarly we can insert multiple records and with the help of SELECT command we can
retrieve inserted rows ( previous).

My SQL> SELECT * FROM Student;

 WHERE CLAUSE
Selecting rows by using the where clause in the SELECT command like :

My SQL > SELECT * FROM Student WHERE class= ‘11’

 UPDATE COMMAND –
To modify or update entries in the table used the UPDATE command like:

My SQL > UPDATE Student SET class = ‘11’

WHERE Student_Name= “Adarsh”;

 DELETE COMMAND –
My SQL > DELETE FROM Student WHERE

Name=”Adarsh”;

 BETWEEN COMMAND –
To access data in the specify range the use BETWEEN command like:
My SQL> SELECT * FROM Student WHERE class BETWEEN ‘X’ and ‘XII’;

 ORDER BY CLAUSE -
A query result can be ordered in ascending (A to Z) or descending (Z to A) order as per the
any column.

By default the column order will be ascending.

For example:

My SQL> SELECT * FROM Student ORDER BY CLAUSE DESC;

 TABLE CONSTRAINTS IN SQL DATABASE


The following constraints are commonly used in SQL database:

Primary key

Foreign key

Not null

Unique

Check

Default

Index

Common questions

Powered by AI

A primary key uniquely identifies each row in a table, ensuring that each record can be precisely accessed and linked to other tables. A foreign key, in contrast, is a field that establishes links between tables by referencing the primary key in a different table, facilitating relational database structures by preserving referential integrity .

Atomicity ensures that database transactions are completed entirely or not at all, maintaining data integrity by preventing partial updates that could lead to data inconsistency. It guarantees that if an operation within a transaction fails, the entire transaction is rolled back, ensuring that incomplete data does not corrupt the database .

The BETWEEN command in SQL enhances queries by allowing range-based condition checks, such as selecting records where a field's value lies within a specified range. For example, `SELECT * FROM Student WHERE class BETWEEN 'X' AND 'XII';` efficiently retrieves records where the class field falls within the range of 'X' to 'XII', simplifying the task of range queries .

MySQL offers advantages such as portability, open-source availability, strong security features, and compatibility with various platforms, making it suitable for web-based applications. However, limitations include potentially slower performance for complex queries compared to some commercial databases and less advanced features for enterprise-level applications. Its popularity in the LAMP stack highlights its effectiveness in web server environments .

SQL constraints like NOT NULL ensure that critical fields must contain valid data, preventing missing or undefined values from entering the database, while the UNIQUE constraint ensures that no duplicate values are inserted into a column, preserving data's uniqueness. These constraints enhance the database's quality by promoting data accuracy and reliability .

The SQL SELECT command is central to DQL as it retrieves data from databases, allowing users to query specific information based on conditions. It can impose order on data using the ORDER BY clause to sort the results in ascending or descending order, enhancing the readability and analysis of data retrieved from databases .

Referential integrity is crucial as it ensures that relationships between tables remain consistent, preventing orphaned records and maintaining valid links. Foreign key constraints enforce referential integrity by ensuring that any value in a foreign key column matches a primary key value in the referenced table, thereby preserving the relational structure of the database .

DDL commands define and manage the database's schema by setting up the structure of tables and databases. Common DDL commands include CREATE, which establishes new tables or databases; DROP, which deletes them; ALTER, which modifies existing database objects; and TRUNCATE, which removes all records from a table. These commands provide essential tools for defining and maintaining database structures .

'No duplicity' ensures that the relational table does not contain duplicate rows, which is crucial for maintaining accuracy and efficiency in data retrieval and storage. By preventing redundant data, databases can perform operations faster and require less storage space, making data handling more efficient .

DML commands such as INSERT, DELETE, and UPDATE allow users to modify and manipulate data within a database. For example, the INSERT command is used to add new rows to a table, such as in the operation: `INSERT INTO Student (student_name, FRAME, class) VALUES ('Adarsh', 'Deepak_Gupta', '11A');` allowing for dynamic data management .

You might also like