EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

Uses of SQL

By Priya PedamkarPriya Pedamkar

Home » Data Science » Data Science Tutorials » SQL Tutorial » Uses of SQL

Top uses of SQL

Introduction to Uses Of SQL

SQL or Structured Query Language is specifically used by business professionals or program developers for administering, updating, maintaining and manipulating the databases or tables that are used for business decision-making. It is usually used to fetch data, update the contents of the table, or operate on the structure of the database or tables, using any type of database tools, which will have a user interface to apply the operations on the database. SQL can be used for both relational and multidimensional types of databases. SQL is a declarative language which means it is a programming paradigm, a style of building the structure and elements of computer programs that express the logic of a computation without describing its control flow.

Some of the famous Databases are listed below:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Source Common name Full name
ANSI/ISO Standard SQL/PSM SQL/Persistent Stored Modules
Interbase / Firebird PSQL Procedural SQL
IBM DB2 SQL PL SQL Procedural Language (implements SQL/PSM)
IBM Informix SPL Stored Procedural Language
IBM Netezza NZPLSQL[20] (based on Postgres PL/pgSQL)
Invantive PSQL[21] Invantive Procedural SQL (implements SQL/PSM and PL/SQL)
Microsoft / Sybase T-SQL Transact-SQL
Mimer SQL SQL/PSM SQL/Persistent Stored Module (implements SQL/PSM)
MySQL SQL/PSM SQL/Persistent Stored Module (implements SQL/PSM)
MonetDB SQL/PSM SQL/Persistent Stored Module (implements SQL/PSM)
NuoDB SSP Starkey Stored Procedures
Oracle PL/SQL Procedural Language/SQL (based on Ada)
PostgreSQL PL/pgSQL PostgreSQL (implements SQL/PSM)
SAP R/3 ABAP Advanced Business Application Programming
SAP HANA SQLScript SQLScript
Sybase Watcom-SQL SQL Anywhere Watcom-SQL Dialect
Teradata SPL Stored Procedural Language

Uses OF SQL

Examples given below are based on dummy table with table name “student_records” having columns id, name, address, and mobile.

Constraints: “id” is used as the primary key of the table and one more column with name “mobile” and this column contains only unique data;

1. DQL

It stands for Data Query Language. It is used to retrieve data from the database.

The SQL statement is SELECT.

Example:

SELECT * from student_records;

2. DDL

It stands for Data Definition Language. This is used to define database schema, thus it deals with the description of database schema and is used to create and modify the structure of database objects in the database. Thus the SQL statements are CREATE, DROP, ALTER, TRUNCATE, COMMENT, RENAME.

Example:

CREATE TABLE student_records
(id integer NOT NULL DEFAULT,
name character varying,
address character varying,
mobile numeric,
CONSTRAINT student_records_pkey PRIMARY KEY (id)
)
DROP TABLE student_records;
ALTER TABLE student_records ALTER COLUMN mobile character varying;

3. DML

It stands for Data Manipulation Language. It is used to store, modify, delete and update data in the database. Thus the SQL statements are INSERT, UPDATE and DELETE.

Example:

INSERT into student_records values (1,”name”,”address”, mobile);
UPDATE student_records set address = “new address” where name= “name”;
DELETE from student_records where mobile = [enter_mobile_number];
TRUNCATE table student_records;

4. DCL

It stands for Data Control Language. It is used to grant access to data stored in the database.

SQL statements are GRANT and REVOKE.

Syntax:

REVOKE privilege_name
On object_name
From {user_name | PUBLIC | role_name};
GRANT privilege_name
On object_name
To {user_name | PUBLIC | role_name}
[WITH GRANT OPTION];

NOTE: To use GRANT command-specific role_name should be created first.

5. Database Transaction Management

Transaction Management means to maintain the transaction related to the database i.e. following the basic rules for ACID properties of the database. The transaction has only two results i.e. either success or failure. Thus the SQL Statement is TRANSACTION, COMMIT, ROLLBACK, SAVEPOINT.

Popular Course in this category
SQL Training Program (7 Courses, 8+ Projects)7 Online Courses | 8 Hands-on Projects | 73+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.5 (5,609 ratings)
Course Price

View Course

Related Courses
JDBC Training (6 Courses, 7+ Projects)PHP Training (5 Courses, 3 Project)Windows 10 Training (4 Courses, 4+ Projects)PL SQL Training (4 Courses, 2+ Projects)Oracle Training (14 Courses, 8+ Projects)

6. Procedures, User-defined Functions, Triggers, Indexes, and others

We can write procedures, user-defined functions, triggers, indexes, cursors as per the requirements which is nothing but SQL statements to make our work easy to meet the business requirements.

7. Reporting Purpose

SQL queries are very important from report perspective which every project have. We can write queries for standalone reports also for fetching data for the report.

8. Manual Analysis

SQL queries are very important for analysis when manual interventions are necessary. With the uses of SQL queries we can filter out the necessary data from the structured data and it could be used for analysis.

9. SQL with NTC Hosting

Even the MySQL hosting service provides the ability for the construction of big and powerful websites, web-based applications and programs. MySQL open source database solution and insist on speed, stability and scalability, then MySQL hosting solution is needed.

10. SQL Join

A SQL join is an instruction to combine data from two sets of data (i.e. two or more tables).

  • (INNER) JOIN: Returns matching values in both tables as output.
  • LEFT (OUTER) JOIN: It returns all records of the left table and the matching records of the right table as output.
  • RIGHT (OUTER) JOIN: It returns all records 0f the right table, and the matching records of the left table as output.
  • FULL (OUTER) JOIN: It returns all records if there is a match in either of the table i.e. left or right.

SQL Join

11. SQL Union

The result-set of two or more SELECT statements can be joined by UNION.

12. SQL Wildcards

A wildcard character is a special character in SQL which are used to substitute any other character(s) in a string.

SQL Wildcard Operators: ‘%’ and ‘_’ are called wildcards operators.

NOTE:

  • % – Representing zero, one, or multiple characters in a character value ( used while filtering).
  • _ – Representing a single character.

Conclusion

So it can be concluded at the end that even today with the fast-growing technologies and evolution of no SQL databases in the market, Uses of SQL still plays an important role for structured data. SQL provides flexibility of querying the tabular data with SQL queries which is a great help in many ways.

Recommended Articles

This has been a guide to Uses of SQL. Here we have explained the basic concept and different uses of SQL with examples. You may also look at the following articles –

  1. SQL Server vs PostgreSQL
  2. IS SQL Microsoft?
  3. Cheat Sheet MySQL
  4. Careers in SQL Server

SQL Training Program (7 Courses, 8+ Projects)

7 Online Courses

8 Hands-on Projects

73+ Hours

Verifiable Certificate of Completion

Lifetime Access

Learn More

3 Shares
Share
Tweet
Share
Primary Sidebar
SQL Tutorial
  • Basic
    • What is SQL
    • Careers in SQL
    • Careers in SQL Server
    • IS SQL Microsoft?
    • SQL Management Tools
    • What is SQL Developer
    • Uses of SQL
    • How to Install SQL Server
    • What is SQL Server
    • Database in SQL
    • SQL Data Types
    • SQL Keywords
    • Composite Key in SQL
    • SQL Constraints
    • Transactions in SQL
    • First Normal Form
    • SQL Server Data Types
    • SQL Administration
    • SQL Variables
    • SQL Enum
    • Cheat sheet SQL
  • Operators
    • SQL Operators
    • SQL Arithmetic Operators
    • SQL Logical Operators
    • SQL String Operators
    • Ternary Operator in SQL
  • Commands
    • SQL Commands
    • SQL Alter Command
    • SQL Commands Update
    • SQL DML Commands
    • SQL DDL Commands
    • FETCH in SQL
  • Clause
    • SQL Clauses
    • SQL IN Operator
    • SQL LIKE Clause
    • SQL NOT Operator
    • SQL Minus
    • SQL WHERE Clause
    • SQL with Clause
    • SQL HAVING Clause
    • GROUP BY clause in SQL
    • SQL GROUP BY DAY
    • ORDER BY Clause in SQL
    • SQL ORDER BY CASE
    • SQL ORDER BY DATE
    • SQL ORDER BY Alphabetical
    • SQL ORDER BY Ascending
    • SQL Order by Count
    • SQL GROUP BY Month
    • SQL GROUP BY Multiple Columns
    • SQL GROUPING SETS
  • Queries
    • SQL Insert Query
    • SQL SELECT Query
    • SQL SELECT RANDOM
    • SQL Except Select
    • SQL Subquery
    • SQL SELECT DISTINCT
    • SQL WITH AS Statement
  • Keys
    • SQL Keys
    • Primary Key in SQL
    • Foreign Key in SQL
    • Unique Key in SQL
    • Alternate Key in SQL
    • SQL Super Key
  • Functions
    • SQL Date Function
    • SQL String Functions
    • SQL Compare String
    • SQL Window Functions
    • SQL Timestamp
    • SQL TO_DATE()
    • SQL DATEADD()
    • SQL DATEDIFF()
    • ANY in SQL
    • LIKE Query in SQL
    • BETWEEN in SQL
    • LTRIM() in SQL
    • TOP in SQL
    • SQL Select Top
    • Merge SQL
    • SQL TRUNCATE()
    • SQL UNION
    • SQL ALL
    • SQL INTERSECT
    • SQL Alias
    • SQL Server Substring
    • CUBE in SQL
    • SQL RANK()
    • SQL MOD()
    • SQL CTE
    • SQL LAG()
    • SQL MID
    • SQL avg()
    • SQL WEEK
    • SQL DELETE
    • SQL DATEPART()
    • SQL DECODE()
    • SQL DENSE_RANK()
    • SQL NTILE()
    • SQL NULLIF()
    • SQL Stuff
    • SQL Ceiling
    • SQL EXISTS
    • SQL LEAD()
    • SQL COALESCE
    • SQL BLOB
    • SQL ROW_NUMBER
    • SQL Server Replace
    • SQL Server Permission
    • T-SQL INSERT
    • SQL Ranking Function
  • Joins
    • Join Query in SQL
    • Types of Joins in SQL
    • Types of Joins in SQL Server
    • SQL Inner Join
    • SQL Join Two Tables
    • SQL Delete Join
    • SQL Left Join
    • SQL Right Join
    • SQL Cross Join
    • SQL Outer Join
    • SQL Full Join
    • SQL Self Join
    • Natural Join SQL
    • SQL Multiple Join
  • Advanced
    • SQL Formatter
    • SQL Injection Attack
    • Aggregate Functions in SQL
    • IF ELSE Statement in SQL
    • SQL CASE Statement
    • SQL While Loop
    • SQL INSTR()
    • What is Procedure in SQL
    • Stored Procedure in SQL?
    • SQL Server Constraints
    • SQL DELETE ROW
    • Column in SQL
    • Table in SQL
    • SQL Virtual Table
    • SQL Merge Two Tables
    • SQL Table Partitioning
    • SQL Temporary Table
    • SQL Clone Table
    • SQL Rename Table
    • SQL LOCK TABLE
    • SQL Clear Table
    • SQL DESCRIBE TABLE
    • SQL Mapping
    • Cursors in SQL
    • AND in SQL
    • Wildcard in SQL
    • SQL FETCH NEXT
    • SQL Views
    • SQL Delete View
    • Triggers in SQL
    • SQL UPDATE Trigger
    • SQL AFTER UPDATE Trigger
    • SQL Update Statement
    • SQL DROP TRIGGER
    • Types of SQL Views
    • SQL Port
    • SQL Clustered Index
    • SQL COMMIT
    • Distinct Keyword in SQL
    • PARTITION BY in SQL
    • SQL Set Operators
    • SQL UNION ALL
    • Metadata in SQL
    • SQL Bulk Insert
    • Array in SQL
    • SQL REGEXP
    • JSON in SQL
    • SQL For loop
    • EXPLAIN in SQL
    • SQL Cluster
    • SQL Backup
    • SQL Pattern Matching
    • SQL Users
    • ISNULL SQL Server
    • SQL pivot
    • SQL Import CSV
  • Interview Questions
    • SQL Interview Questions
    • Advance SQL Interview Questions
    • SQL Joins Interview Questions
    • SQL Server Interview Questions

Related Courses

JDBC Training Course

PHP course

Windows 10 Training

SQL Course Training

PL/SQL Certification Courses

Oracle Certification Courses

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA Login

Forgot Password?

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

Special Offer - SQL Training Program (7 Courses, 8+ Projects) Learn More