Download SQL notes for learning Database and more Study notes Database Management Systems (DBMS) in PDF only on Docsity!
SQL
What is SQL?
• SQL stands for Structured Query Language
• SQL is a standard language for storing,
manipulating and retrieving data in databases.
• SQL lets you access and manipulate databases
• SQL is an ANSI (American National Standards
Institute) standard
- (^) SQL is a language that all commercial RDBMS
implementations understand.
- SQL is a non-procedural language
- We would be discussing SQL with respect to
oracle syntax
How SQL Works?
- (^) DDL (Data Definition Language)
- (^) Create - Creates a new table, a view of a table, or other object in the database.
- (^) Alter - Modifies an existing database object, such as a table.
- (^) Drop - Deletes an entire table, a view of a table or other objects in the database.
- (^) Truncate - Is used to delete complete data from an existing table. SQL Statements
- (^) DML (Data Manipulation Language)
- (^) Insert - Creates a record.
- (^) Update - Modifies records.
- (^) Delete - Deletes records.
- (^) Select - Retrieves certain records from one or more tables. SQL Statements
- (^) TCL (Transaction Control Language)
- (^) Commit - To save the changes.
- (^) Rollback - To roll back the changes. SQL Statements
Data types Data Type Explanation Char (size) Where size is the number of characters to store. Fixed length strings. Space padded. The maximum number of characters this data type can hold is 255 characters. Varchar(size)/ varchar2(size) Where size is the number of characters to store. variable length strings. Date Standard format is DD – MON – YY Number(p , s) Where p is the precision ands is the scale. For ex. Number(7,2) is a number that has 5 digits before the decimal and 2 digits after the decimal.
DDL(Data Definition Language)
Creating and Managing Tables
Database Objects
What is a table?
• The data in an RDBMS is stored in database
objects which are called as tables. This table is
basically a collection of related data entries
and it consists of numerous columns and rows.
• Remember, a table is the most common and
simplest form of data storage in a relational
database. The following program is an example
of a CUSTOMERS table −
What is a field?
• Every table is broken up into smaller entities
called fields. The fields in the CUSTOMERS
table consist of ID, NAME, AGE, ADDRESS and
SALARY.
• A field is a column in a table that is designed
to maintain specific information about every
record in the table.
What is a Record or a Row?
• A record is also called as a row of data is each
individual entry that exists in a table. For
example, there are 7 records in the above
CUSTOMERS table.
1 Ramesh 23 Ghaziabad 22,