Basics of SQL!!

 SQL(STRUCTURED QUERY LANGUAGE)


  • Structured Query Language is a language that is used to operate relational databases.
  • Some of the major ways in which SQL is used in conjunction with a relational database are for the purposes of storing, retrieving, and manipulating data stored in a relational databases.


  • Structured Query Language, or SQL, is the language that helps manage databases. It helps in creating data, operating on it, and retrieving it. 
  • It is also the standard language used in the Relational Database Systems. Various Relational Database Systems like MySQL, Sybase, Oracle, MS Access, Postgres, Infomix, SQL Server, etc., have SQL as their base language.
  • The language to communicate with the relational database is the SQL or Structured Query Language. SQL programming helps to operate the relational database and derive information from it.

Why SQL is required?

SQL is required because it offers the following advantages for the users:

  • SQL helps in creating new databases, views, and tables.
  • It is used for inserting, updating, deleting, and retrieving data records in the database.
  • It enables users to interact with data stored in relational database management systems.
  • SQL is required to create views, stored procedures, functions in a database.

Why is SQL programming so widely used?

Structured Query Language programming is used so extensively for the following reasons.

  • SQL lets you access any data within the relational database
  • You can describe the data in the database using SQL
  • Using SQL you can manipulate the data with the relational database
  • SQL can be embedded within other languages through SQL modules & libraries
  • SQL lets you easily create and drop databases and tables
  • SQL allows you to create views. functions, and stored procedures in databases
  • Using SQL you can set permissions on procedures, tables, and views.

Features of SQL:

  • SQL is a very simple and easy-to-learn language.
  • SQL is versatile as it works with database systems from Oracle, IBM, Microsoft, etc.
  • SQL is an ANSI and ISO standard language for database creation and manipulation.
  • SQL has a well-defined structure as it uses long-established standards
  • SQL is very fast in retrieving large amounts of data very efficiently.
  • SQL lets you manage databases without knowing a lot of coding.

Applications of SQL:

  • SQL is used as a Data Definition Language (DDL) meaning you can independently create a database, define its structure, use it and then discard it when you are done with it.
  • It is also used as a Data Manipulation Language (DML) which means you can use it for maintaining an already existing database. SQL is a powerful language for entering data, modifying data, and extracting data with regard to a database
  • It is also deployed as a Data Control Language (DCL) which specifies how you can protect your database against corruption and misuse.
  • It is extensively used as a Client/Server language to connect the front-end with the back-end thus supporting the client/server architecture
  • It can also be used in the three-tier architecture of a client, an application server, and a database that defines the Internet architecture.

The most Important SQL commands:

  • SELECT - extracts data from a database
  • UPDATE - updates data in a database
  • DELETE - deletes data from a database
  • INSERT INTO - inserts new data into a database
  • CREATE DATABASE - creates a new database
  • ALTER DATABASE - modifies a database
  • CREATE TABLE - creates a new table
  • ALTER TABLE - modifies a table
  • DROP TABLE - deletes a table
  • CREATE INDEX - creates an index (search key)
  • DROP INDEX - deletes an index

Various Aggregate Functions: 

COUNT– the number of elements in the given group is counted

SUM– computes the total of the given attribute/expression in the specified category

AVG– computes the average value of a given attribute/expression in a fixed category

MIN– finds the smallest value in a set of numbers

MAX– returns the highest value in the defined group





Comments