Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
25 views

Introduction To SQL

Uploaded by

santoshdvg1997
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Introduction To SQL

Uploaded by

santoshdvg1997
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

SQL

Topperworld.in

INTRODUCTION

• SQL is a short-form of the structured query language, and it is pronounced as


S-Q-L or sometimes as See-Quell.
• This database language is mainly designed for maintaining the data in
relational database management systems.
• It is a special tool used by data professionals for handling structured data
(data which is stored in the form of tables).
• It is also designed for stream processing in RDSMS.
• You can easily create and manipulate the database, access and modify the
table rows and columns, etc.

• Big enterprises like Facebook, Instagram, and LinkedIn, use SQL for storing
the data in the back-end.

©Topperworld
SQL

❖ Characteristics of SQL
➢ SQL may be utilized by quite a number of users, which include people
with very little programming experience.
➢ SQL is a non-procedural language.
➢ We can without difficulty create and replace databases in SQL. It isn’t a
time-consuming process.
➢ SQL is primarily based totally on ANSI standards.
➢ SQL does now no longer have a continuation individual.
➢ SQL is entered into the SQL buffer on one or more lines.
➢ SQL makes use of a termination individual to execute instructions
immediately. It makes use of features to carry out a few formatting.
➢ It uses functions to perform some formatting.

❖ History of SQL
⚫ "A Relational Model of Data for Large Shared Data Banks" was a paper
which was published by the great computer scientist "E.F. Codd" in 1970.
⚫ The IBM researchers Raymond Boyce and Donald Chamberlin originally
developed the SEQUEL (Structured English Query Language) after
learning from the paper given by E.F. Codd. They both developed the SQL
at the San Jose Research laboratory of IBM Corporation in 1970.
⚫ At the end of the 1970s, relational software Inc. developed their own first
SQL using the concepts of E.F. Codd, Raymond Boyce, and Donald
Chamberlin. This SQL was totally based on RDBMS.

©Topperworld
SQL

❖ Uses of SQL
• Data definition: It is used to define the structure and organization of
the stored data and the relationships among the stored data items.
• Data retrieval: SQL can also be used for data retrieval.

• Data manipulation: If the user wants to add new data, remove data,
or modifying in existing data then SQL provides this facility also.
• Access control: SQL can be used to restrict a user’s ability to retrieve,
add, and modify data, protecting stored data against unauthorized
access.
• Data sharing: SQL is used to coordinate data sharing by concurrent
users, ensuring that changes made by one user do not inadvertently
wipe out changes made at nearly the same time by another user.

❖ SQL Rules
 A ‘;’ is used to end SQL statements.
 Statements may be split across lines, but keywords may not.
 Identifiers, operator names, and literals are separated by one or more
spaces or other delimiters.
 A comma (,) separates parameters without a clause.
 A space separates a clause.
 Reserved words cannot be used as identifiers unless enclosed with
double quotes.
 Identifiers can contain up to 30 characters.
 Identifiers must start with an alphabetic character.
 Characters and date literals must be enclosed within single quotes.
 Numeric literals can be represented by simple values.

©Topperworld
SQL

 Comments may be enclosed between /* and */ symbols and maybe


multi-line.

❖ Process of SQL

• When we are executing the command of SQL on any Relational database


management system, then the system automatically finds the best
routine to carry out our request, and the SQL engine determines how to
interpret that particular command.

Structured Query Language contains the following four components in its


process:

) Query Dispatcher

) Optimization Engines

) Classic Query Engine

) SQL Query Engine, etc.

©Topperworld
SQL

❖ SQL commands
Developers use structured query language (SQL) commands, which are
specific keywords or SQL statements, to work with data stored in relational
databases. The following are categories for SQL commands.

1. Data Definition Language


SQL commands used to create the database structure are known as data
definition language (DDL).
Based on the needs of the business, database engineers create and modify
database objects using DDL.
The CREATE command, for instance, is used by the database engineer to create
database objects like tables, views, and indexes.

Command

1. CREATE
Creates a new table, a view of a table, or other object in the database.

2. 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.

©Topperworld
SQL

2. Data Manipulation Language


A relational database can be updated with new data using data manipulation
language (DML) statements.
The INSERT command, for instance, is used by an application to add a new
record to the database.

Command

1. SELECT
Retrieves certain records from one or more tables.

2. INSERT
Creates a record.

3. UPDATE
Modifies records.

4. DELETE
Deletes records.

3. Data Query Language


Data retrieval instructions are written in the data query language (DQL), which
is used to access relational databases.
The SELECT command is used by software programs to filter and return
particular results from a SQL table.

©Topperworld
SQL

4. Data Control language


Data control language (DCL) is a programming language used by database
administrators to control or grant other users access to databases.
For instance, they can allow specific applications to manipulate one or more
tables by using the GRANT command.

Command

1. GRANT
Gives a privilege to the user.

2. REVOKE
Takes back privileges granted by the user.

5. Transaction Control Language


To automatically update databases, the relational engine uses transaction
control language (TCL).
For instance, the database can reverse a mistaken transaction using the
ROLLBACK command.

©Topperworld
SQL

SQL vs No-SQL

SQL No-SQL

1. SQL is a relational database 1. While No-SQL is a non-relational or


management system. distributed database management
system.

2. The query language used in this 2. The query language used in the No-
database system is a structured SQL database systems is a non-
query language. declarative query language.

3. The schema of SQL databases is 3. The schema of No-SQL databases is a


predefined, fixed, and static. dynamic schema for unstructured data.

4. These databases are vertically 4. These databases are horizontally


scalable. scalable.

5. The database type of SQL is in 5. The database type of No-SQL is in the


the form of tables, i.e., in the form form of documents, key-value, and
of rows and columns. graphs.

6. It follows the ACID model. 6. It follows the BASE model.

7. Complex queries are easily 7. NoSQL databases cannot handle


managed in the SQL database. complex queries.

©Topperworld
SQL

8. This database is not the best 8. While No-SQL database is a perfect


choice for storing hierarchical option for storing hierarchical data.
data.

9. All SQL databases require 9. Many No-SQL databases do not


object-relational mapping. require object-relational mapping.

10. Gauges, CircleCI, Hootsuite, 10. Airbnb, Uber, and Kickstarter are the
etc., are the top enterprises that top enterprises that are using this query
are using this query language. language.

11. SQLite, Ms-SQL, Oracle, 11. Redis, MongoDB, Hbase, BigTable,


PostgreSQL, and MySQL are CouchDB, and Cassandra are examples
examples of SQL database of NoSQL database systems.
systems.

❖ Advantages of SQL

SQL provides various advantages which make it more popular in the field of data
science. It is a perfect query language which allows data professionals and users
to communicate with the database.

Following are the best advantages or benefits of Structured Query Language:

1. No programming needed

SQL does not require a large number of coding lines for managing the database
systems. We can easily access and maintain the database by using simple SQL
syntactical rules. These simple rules make the SQL user-friendly.

©Topperworld
SQL

2. High-Speed Query Processing

A large amount of data is accessed quickly and efficiently from the database by
using SQL queries. Insertion, deletion, and updation operations on data are also
performed in less time.

3. Standardized Language

SQL follows the long-established standards of ISO and ANSI, which offer a
uniform platform across the globe to all its users.

4. Portability

The structured query language can be easily used in desktop computers, laptops,
tablets, and even smartphones. It can also be used with other applications
according to the user's requirements.

5. Interactive language

We can easily learn and understand the SQL language. We can also use this
language for communicating with the database because it is a simple query
language. This language is also used for receiving the answers to complex
queries in a few seconds.

6. More than one Data View

The SQL language also helps in making the multiple views of the database
structure for the different database users.

©Topperworld
SQL

❖ Disadvantages of SQL

With the advantages of SQL, it also has some disadvantages, which are as
follows:

1. Cost

The operation cost of some SQL versions is high. That's why some programmers
cannot use the Structured Query Language.

2. Interface is Complex

Another big disadvantage is that the interface of Structured query language is


difficult, which makes it difficult for SQL users to use and manage it.

3. Partial Database control

The business rules are hidden. So, the data professionals and users who are
using this query language cannot have full database control.

©Topperworld

You might also like