0% found this document useful (0 votes)
108 views

Introduction To SQL:: Experiment - 1 Objective: To Study Theory and Concepts About Structured Query Language (SQL)

SQL is a programming language used to define and manipulate data in relational database management systems. The document discusses the different types of SQL statements including DDL for data definition, DML for data manipulation, and DCL for data control. It also covers the various data types used in SQL and provides a brief history of Oracle database releases from 1979 to 1992, highlighting new features with each release such as support for distributed queries, PL/SQL, and improved security capabilities.

Uploaded by

User
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)
108 views

Introduction To SQL:: Experiment - 1 Objective: To Study Theory and Concepts About Structured Query Language (SQL)

SQL is a programming language used to define and manipulate data in relational database management systems. The document discusses the different types of SQL statements including DDL for data definition, DML for data manipulation, and DCL for data control. It also covers the various data types used in SQL and provides a brief history of Oracle database releases from 1979 to 1992, highlighting new features with each release such as support for distributed queries, PL/SQL, and improved security capabilities.

Uploaded by

User
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
You are on page 1/ 7

DATABASE MANAGEMENT SYSTEMS LAB

EXPERIMENT 1
Objective : To study theory and concepts about Structured Query Language
(SQL) :
Introduction to SQL :
SQL is a special-purpose programming language designed for managing data held in a relational
database management system (RDBMS), or for stream processing in a relational data stream
management system (RDSMS).
Originally based upon relational algebra and tuple relational calculus, SQL consists of a data
definition language and a data manipulation language. The scope of SQL includes data insert,
query, update and delete, schema creation and modification, and data access control. Although
SQL is often described as, and to a great extent is, a declarative language (4GL), it also includes
procedural elements.SQL was one of the first commercial languages for Edgar F. Codd's
relational model, as described in his influential 1970 paper, "A Relational Model of Data for
Large Shared Data Banks." Despite not entirely adhering to the relational model as described by
Codd, it became the most widely used database language
SQL (pronounced SEQUEL) is the programming language that defines and manipulates the
database. SQL databases are relational databases, which means that data is stored in a set of
simple relations.

SQL Statements :
All operations on the information in an Oracle database are performed using SQL statements. A
SQL statement is a string of SQL text. A statement must be the equivalent of a complete SQL
sentence, as in:
SELECT last_name, department_id FROM employees;
Only a complete SQL statement can run successfully. A sentence fragment, such as the
following, generates an error indicating that more text is required:
SELECT last_name
A SQL statement can be thought of as a very simple, but powerful, computer program or
instruction. SQL statements are divided into the following categories:
Data Definition Language (DDL) Statements
Data Manipulation Language (DML) Statements
Transaction Control Statements
Session Control Statements
System Control Statements

Page 1

DATABASE MANAGEMENT SYSTEMS LAB


Embedded SQL Statements

The Data Definition Language (DDL):


This component of the SQL language is used to create and modify tables and other objects in the
database. For tables there are three main commands:
CREATE TABLE <tablename> to create a table in the database
DROP TABLE <tablename> to remove a table from the database
ALTER TABLE <tablename> to add or remove columns from a table in the database
The Data Manipulation Language (DML):
This component of the SQL language is used to manipulate data within a table. There are four
main commands:
SELECT to select rows of data from a table
INSERT to insert rows of data into a table
UPDATE to change rows of data in a table
DELETE to remove rows of data from a table
The Data Control Language (DCL):
This component of the SQL language is used to create privileges to allow users access to, and
manipulation of, the database. There are two main commands:
1. GRANT to grant a privilege to a user
2. REVOKE to revoke (remove) a privilege from a user

Transaction Control Statements :


These statements manage the changes made by DML statements. They enable a user to group
changes into logical transactions. Examples include COMMIT, ROLLBACK, and SAVEPOINT.
Session Control Statements :
These statements let a user control the properties of the current session, including enabling and
disabling roles and changing language settings. The two session control statements are ALTER
SESSION and SET ROLE.
Page 2

DATABASE MANAGEMENT SYSTEMS LAB


System Control Statements :
These statements change the properties of the Oracle database instance. The only system control
statement is ALTER SYSTEM. It lets users change settings, such as the minimum number of
shared servers, kill a session, and perform other tasks.
Embedded SQL Statements :
These statements incorporate DDL, DML, and transaction control statements in a procedural
language program, such as those used with the Oracle precompilers. Examples include OPEN,
CLOSE, FETCH, and EXECUTE.

Data types used in SQL:


1) Char(n) (or character(n)): fixed-length character string, with user-specified length.
2) Varchar(n) (or character varying): variable-length character string, with user-specified
maximum length.
3) Int or integer: an integer (length is machine-dependent).
4) Smallint: a small integer (length is machine-dependent).
5) Numeric(p, d): a fixed-point number with user-specified precision, consists of p digits (plus a
sign) and d of p digits are to the right of the decimal point. E.g., numeric(3, 1) allows 44.5 to be
stored exactly but not 444.5.
6) Real or double precision: floating-point or double-precision floating-point numbers, with
machine-dependent precision.
7) Float(n): floating-point, with user-specified precision of at least n digits.
8) Date: a calendar date, containing four digit year, month, and day of the month.
9) Time: the time of the day in hours, minutes, and second.

Oracle Database Description


An Oracle database is a collection of data treated as a unit. The purpose of a database is to store
and retrieve related information. A database server is the key to solving the problems of
information management. In general, a server reliably manages a large amount of data in a
multiuser environment so that many users can concurrently access the same data. All this is
accomplished while delivering high performance. A database server also prevents unauthorized
access and provides efficient solutions for failure recovery.

Page 3

DATABASE MANAGEMENT SYSTEMS LAB


Oracle Database is the first database designed for enterprise grid computing, the most flexible
and cost effective way to manage information and applications. Enterprise grid computing
creates large pools of industry-standard, modular storage and servers. With this architecture,
each new system can be rapidly provisioned from the pool of components. There is no need for
peak workloads, because capacity can be easily added or reallocated from the resource pools as
needed.
The database has logical structures and physical structures. Because the physical and logical
structures are separate, the physical storage of data can be managed without affecting the access
to logical storage structures.

1979 - Oracle release 2


The first commercial RDBMS was built using PDP-11 assembler language. Although they
created a commercial version of RDBMS in 1977, it wasn't available for sale until 1979 with the
launch of Oracle version 2. The company decided against starting with version 1 because they
were afraid that the term "version 1" might be viewed negatively in the marketplace. USA Air
Force and then CIA were the first customers to use Oracle 2.
In 1982 there was another change of the companys name, from RSI to Oracle Systems
Corporation so as to match its popular database name. The current company name comes from a
CIA project that Larry Ellison had previously worked on code named Oracle.
1983 - Oracle release 3
The Oracle version 3 was developed in 1983. This version was assembled using C programming
language and could run in mainframes, minicomputers, and PCs or any hardware with a C
compiler. It supported the execution of SQL statements and transactions. This version also
included new options of pre-join data to increase Oracle optimization.
1984 - Oracle release 4
Despite the advances introduced in version 3, demand was so great that Oracle was compelled to
improve the software even further with the release of version 4 in 1984. Oracle version 4
included support for reading consistency, which made it much faster than any previous version.
Oracle version 4 also brought us the introduction of the export/import utilities and the report
writer, which allows one the ability to create a report based on a query.
1985 - Oracle release 5
With the introduction of version 5 in 1985, Oracle addressed the increasing use of the internet in
business computing. This version was equipped with the capability to connect clients? software
through a network to a database server. The Clustering Technology was introduced in this
version as well and Oracle became the pioneer using this new concept which would later be
Page 4

DATABASE MANAGEMENT SYSTEMS LAB


known as Oracle Real Application Cluster in version 9i. Oracle version 5 added some new
security features such as auditing, which would help determine who and when someone accessed
the database.
Oracle version 5.1 was launched in 1986 and allowed for supporting distributed queries. Later
that same year Oracle released SQL*Plus, a tool that offers ad hoc data access and report writing.
1986 also brought the release of SQL*Forms, an application generator and runtime system with
facilities for simple application deployment.
1988 - Oracle release 6
The PL/SQL language came with Oracle version 6 in 1988. This version provided a host of new
features including the support of OLTP high-speed systems, hot backup capability and row level
locking which locks only the row or rows being used during a writing operation, rather than
locking an entire table. Prior to the hot backup feature, database administrators were required to
shutdown the database to back it up. Once the hot backup feature was introduced, DBAs could
do a backup while the database was still online.
1992 - Oracle release 7
1992 was a memorable year for Oracle. The company announced Oracle version 7, which was
the culmination of four years of hard work and two years of customer testing before release to
market. This version of Oracle provided a vast array of new features and capabilities in areas
such as security, administration, development, and performance. Oracle 7 also addressed
security concerns by providing full control of who, when, and what users were doing in the
database. Version 7 also allowed us to monitor every command, the use of privileges and the
users access to a particular item.
Oracle7 Release 7.1 introduced some good new capabilities for database administrators, such as
parallel recovery and read-only tablespaces. For the application developments, Oracle inserted
the dynamic SQL, user-defined SQL functions and multiple same-type triggers. The first 64-bit
DBMS was introduced within this version as well as the VLM (Very Large Memory) option.
The feature Oracle Parallel Query could make some complex queries run 5 to 20 times faster.
In 1996 Oracle 7.3 was shipped, offering customers the ability to manage all kinds of data types;
including video, color images, sounds and spatial data. 1996 also brought the release of Oracle's
first biometric authentication for a commercially available database. This technology could
analyze human characteristics, both physical and behavioral, for purposes of authentication.
1997 - Oracle release 8
The Oracle 8 Database was launched in 1997 and was designed to work with Oracle's network
computer (NC). This version supported Java, HTML and OLTP.
1998 - Oracle release 8i

Page 5

DATABASE MANAGEMENT SYSTEMS LAB


Just one year later Oracle released Oracle 8i which was the first database to support Web
technologies such as Java and HTTP. In 2000 Oracle 8i Parallel Server was working with Linux
which eliminated costly downtime.
2001 - Oracle release 9i
Oracle Real Application Cluster came with Oracle 9i Database in 2001. This feature provides
software for clustering and high availability in Oracle database environments. Supporting native
XML was also a new feature of Oracle 9i and this was the first relational database to have these
characteristics. Version 9i release 2 enabled Oracle to integrate relational and multidimensional
database. Despite the fact that hard disks were becoming cheaper, data was increasing very
quickly in databases and Oracle 9i came with a special technology named table compression that
reduced the size of tables by 3 to 10 times and increased the performance when accessing
those tables.
2003 - Oracle release 10g
Although Oracle 9i had only been in the market for two years, Oracle launched version 10g in
2003. The release of 10g brought us the introduction to Grid Computing technology. Data
centers could now share hardware resources, thus lowering the cost of computing infrastructure.
10g was also the first Oracle version to support 64-bit on Linux. With Oracle Database 10g and
Real Application Cluster it was now possible to move from very expensive SMP boxes and
mainframes to an infrastructure that relies on low costs such as UNIX or Windows servers,
which have high availability, scalability and performance.
Oracle has long strived to make their software products available through the internet; but this
effort was only enhanced with the creation of the 10g Express Edition. With the introduction of
the 10g Express Edition in 2005, Oracle gave small business and startup corporations a viable
option to integrate Oracle into the workplace at no cost.
2007 - Oracle release 11g
The latest version of Oracle Database is 11g which was released on July 11th 2007. This version
introduced more features than any other in Oracle history. This version includes:
Oracle Database Replay, a tool that captures SQL statements and lets you replay them all
in another database to test the changes before you actually apply then on a production
database;
Transaction Management using Log Miner and Flashback Data Archive to get DML
statements from redo log files;
Virtual Column Partitioning;
Case sensitive passwords;
Online Patching;
Parallel Backups on same file using RMAN and many others.

Page 6

DATABASE MANAGEMENT SYSTEMS LAB

Objective : Write the syntax for


1.
2.
3.
4.

Creating a table
Insertion of values in the table
Viewing the table contents
Describing the table

Create table
Create table <tablename>
(
<Columnname1> datatype(size) constraint,
<Columnname2> datatype(size) constraint,
.) ;

Insert content
Insert into <tablename> values(value1,value2.);
Insert into <tablename> values(value1,value2..);

View contents
Select * from <tablename> ;

Describe table
Desc <tablename> ;

Page 7

You might also like