Loading...

SQL (Structured Query Language)

SQL

Structured query language (SQL) is a programming language for storing and processing information in a relational database. A relational database stores information in tabular form, with rows and columns representing different data attributes and the various relationships between the data values. You can use SQL statements to store, update, remove, search, and retrieve information from the database. You can also use SQL to maintain and optimize database performance. SQL (Structured Query Language) is used to perform operations on the records stored in the database, such as Inserting Records, Updating Records, Deleting Records, Creating and Modifying Database Tables, Views.

History of SQL

SQL was invented in the 1970s based on the relational data model. It was initially known as the structured English query language (SEQUEL). The term was later shortened to SQL. Oracle, formerly known as Relational Software, became the first vendor to offer a commercial SQL relational database management system.

Advantages of SQL

1. No programming needed

2. High-Speed Query Processing

3. Standardized Language

4. Portability

5. Interactive language

6. More than one Data View

Disadvantages of SQL

1. Cost

2. Interface is Complex

3. Partial Database control

SQL Commands

Structured Query Language (SQL) commands are specific keywords or SQL statements that developers use to manipulate the data stored in a relational database. You can categorize SQL commands as follows.

Data Definition Language (DDL) : Data Definition Language (DDL) refers to SQL commands that design the database structure. Database engineers use DDL to create and modify database objects based on the business requirements. For example, the database engineer uses the CREATE command to create database objects such as tables, views, and indexes.

Data Query Language (DQL) : Data Query Language (DQL) consists of instructions for retrieving data stored in relational databases. Software applications use the SELECT command to filter and return specific results from a SQL table.

Data Manipulation Language (DML) : Data Manipulation Language (DML) statements write new information or modify existing records in a relational database. For example, an application uses the INSERT command to store a new record in the database.

Data Control Language (DCL) : Database Administrators use Data Control Language (DCL) to manage or authorize database access for other users. For example, they can use the GRANT command to permit certain applications to manipulate one or more tables.

Transaction Control Language (TCL) : The relational engine uses Transaction Control Language (TCL) to automatically make database changes. For example, the database uses the ROLLBACK command to undo an erroneous transaction.

SQL Standards

SQL standards are a set of formally defined guidelines of the structured query language (SQL). The American National Standards Institute (ANSI) and International Organization for Standardization (ISO) adopted the SQL standards in 1986. Software vendors use the ANSI SQL standards to build SQL database software for developers.

SQL Injection

SQL injection is a cyberattack that involves tricking the database with SQL queries. Hackers use SQL injection to retrieve, modify, or corrupt data in a SQL database. For example, they might fill in a SQL query instead of a person's name in a submission form to carry out a SQL injection attack.

SQL Create Database

Syntax : CREATE DATABASE Database_Name;

Example : CREATE DATABASE JST_DB;

SQL Drop Database

Syntax : DROP DATABASE Database_Name;

Example : DROP DATABASE JST_DB;

SQL Rename Database

Syntax : RENAME DATABASE old_db_name TO new_db_name;

Example : RENAME DATABASE JST_DB TO JST_DAB;

SQL Select Database

Syntax : USE database_name;

Example : USE JST_DB;