Geeksfastprogrammer

Introduction to SQL

INTRODUCTION TO SQL

SQL stands for Structured Query Language.
➤ Structured Query Language(SQL) is the standard command set used to communicate with the relational database management systems.
➤ SQL initially was invented in 1970. it is a database language used for database creation, insertion and deletion.
➤ SQL became a standard of the American National Standards Institute in 1986.


ADVANTAGES OF SQL

➤ SQL enables the end-users and systems personnel to deal with a number of database management systems where it is available.
➤ Applications written in SQL can be easily ported across systems. Such porting could be required when the underlying DBMS needs to be upgraded.
➤ SQL is a high level language that provides a greater degree of abstraction than procedural languages.



SQL WORKS

➤ it is used to create new database.
➤ it is used to create new tables in the database.
➤ it is used to execute query against a database.
➤ it is used to retrieve data from database.
➤ it is used to inserts data records in a database.
➤ it is used to updates records in the database.
➤ it is used to delete records from a database.
➤ it is used to create view in a database.


TYPES OF SQL COMMANDS

SQL statements are divided into the following categories:
➤ Data Definition Language(DDL)
➤ Data Manipulation Language(DML)
➤ Data Query Language(DQL)
➤ Data Control Language(DCL) 



DATA DEFINITION LANGUAGE

➤ Data definition Language is used to create, alter and delete database objects.
➤ The commands used are create, alter and drop.
➤ The principal data definition statements are:
    • Create table, create view, create index
    • Alter table
    • Drop table, drop view, drop index
➤ In case of SQL keyword and Identifier both are case Insensitive, lowercase keyword is same as uppercase keyword. keyword like a create, alter, drop, truncate or we can write CREATE, ALTER, DROP, TRUNCATE. A keyword is nothing but having some predefined meaning.
➤ In case of SQL Identifiers are nothing but name, it can be name to the coloumn, name to the table or name to the constraints, all the names coming under indentifier, names also case insensitive.

CREATE TABLE PERSON(ID NUMBER, FIRST_NAME VARCHAR2(90), AGE NUMBER);