DBMS LAB File Experiment1
DBMS LAB File Experiment1
MODI INSTITUTE OF
ENGINEERING & TECHNOLOGY
N.H-58, MODINAGAR,GHAZIABAD, UTTAR PRADESH,201204
Affiliated to Dr. APJ Abdul Kalam Technical University, Lucknow
A database is an organized collection of data, generally stored and accessed electronically from a
computer system. Where databases are more complex they are often developed using formal design
and modelling techniques.
The database management system (DBMS) is the software that interacts with end users, applications,
and the database itself to capture and analyse the data. The DBMS software additionally encompasses
the core facilities provided to administer the database. The sum total of the database, the DBMS and the
associated applications can be referred to as a "database system". Often the term "database" is also used
to loosely refer to any of the DBMS, the database system or an application associated with the database.
Computer scientists may classify database-management systems according to the database models that
they support. Relational databases became dominant in the 1980s. These model data
as rows and columns in a series of tables, and the vast majority use SQL for writing and querying data.
In the 2000s, non-relational databases became popular, referred to as NoSQL because they use
different query languages.
A database has broad searching functionality. For example, a sales department could quickly search
for and find all sales personnel who had achieved a certain amount of sales over a particular time period.
A database can update records in bulk – even millions or more records. This would be useful, for
example, if you wanted to add new columns or apply a data patch of some sort.
If the database is relational, which most databases are, it can cross-reference records in different tables.
This means that you can create relationships between tables. For instance, if you linked a Customers
table with an Orders table, you could find all purchase orders from the Orders table that a single customer
from the Customers table ever processed, or further refine it to return only those orders processed in a
particular time period – or almost any type of combination you could imagine.
A database can perform complex aggregate calculations across multiple tables. For example, you could
list expenses across multiple retail outlets, including all possible sub-totals, and then a final total.
A database can enforce consistency and data integrity, which means that it can avoid duplication and
ensure data accuracy through its design and a series of constraints.
Structure Query Language(SQL) is a database query language used for storing and managing data in
Relational DBMS. SQL was the first commercial language introduced for E.F Codd's Relational model
of database. Today almost all RDBMS(MySql, Oracle, Infomix, Sybase, MS Access) use SQL as the
standard database query language. SQL is used to perform all types of data operations in RDBMS.On
the surface, a database might seem much like a spread sheet; it has data arranged in columns and rows.
But that is where the similarity ends because a database is far more powerful.
Experiment 1
AIM: Write the queries for Data Manipulation and Data definition Language.
Description :-
DML: A data manipulation language (DML) is a family of syntax elements similar to a computer
programming language used for selecting, inserting, deleting and updating data in a database. Performing
read-only queries of data is sometimes also considered a component of DML.
a. INSERT
b. UPDATE
c. DELETE
d. SELECT
DML COMMANDS:
SYNTAX:
INSERT Statement:
Single Row into a Table: INSERT INTO table – name [column- identifier-comma-list)] VALUES (column-
valuecomma-list);
Multiple Row into a Table: insert into <table name> values (&col1, &col2, ….);
DDL: A data definition language or data description language (DDL) is syntax similar to a computer
programming language for defining data structures, especially database schemas.-
Commands in DDL are:
a. CREATE
b. DROP
c. TRUNCATE
d. RENAME
e. ALTER
DDL COMMANDS:
SYNTAX:
ALTER:
Q1. Write a query to create a table employee with empno, ename, designation, and salary.
VARCHAR2 (10),
Table created.
Q2. Write a query for create a table from an existing table with all the fields.
Table created.
Q3. Write a Query to Alter the column EMP_ID NUMBER(1001) TO EMPNO NUMBER(1009).
Table deleted.
DML QUERIES:
Q3. Write a query to insert the records in to employee using substitution method.
VALUES(&EMPNO,'&ENAME','&DESIGNATIN','&SALARY');
VALUES(&EMPNO,'&ENAME','&DESIGNATIN','&SALARY')
new 1: INSERT INTO EMP VALUES(102,'DHAJVEER','ASST_PROF','35000')
1 row created.
SQL> /
1 row updated.