SQL Basic Overview

BharteeTechRubyOnRails
2 min readJul 15, 2023

--

What is SQL?

SQL stands for Structured Query Language. It is a standard language for accessing and manipulating data in relational database management systems (RDBMS).

SQL DataBase

  • Create, update, and delete tables.
  • Insert, update, and delete data from tables.
  • Select data from tables.
  • Join tables together.
  • Create views.
  • Create stored procedures.
  • Grant and revoke permissions.

SQL Database Table

SQL database is constructed of a number of tables. In a business, SQL tables would be used to divide and simplify the different areas of the operation: One table for Customers, one for Vendors, Employees, and so on.

SQL Database Column

  • Columns represent the structure and attributes of the data stored in a table. Each column has a specific name and data type, which determines the kind of data it can store. For example, a column named “id” may have the data type “INT” (integer) to store numeric identifiers, while a column named “name” may have the data type “VARCHAR” (variable-length character) to store textual data.

SQL Database Row

Rows represent individual records or instances of data within a table. Each row corresponds to a complete set of data associated with a specific entry or entity. For example, in a table of employees, each row may represent a different employee, with each column storing information such as the employee’s ID, name, salary, and so on.

Different Type of SQL Query

Data Manipulation Language (DML): Queries for manipulating data within a database
Data Definition Language (DDL): Queries for defining and managing database structures
Data Control Language (DCL): Queries for controlling access and permissions to the database
Data Query Language (DQL): Queries for retrieving data from the database

Data Manipulation Language (DML):

DML queries are used to manipulate and modify data within a database. Examples include:

  • SELECT: Retrieves data from a table.
  • INSERT: Inserts new records into a table.
  • UPDATE: Modifies existing records in a table.
  • DELETE: Removes records from a table.

Data Definition Language (DDL):

DDL queries are used to define and manage the structure of a database. Examples include:

  • CREATE TABLE: Creates a new table.
  • ALTER TABLE: Modifies the structure of an existing table.
  • DROP TABLE: Deletes a table from the database.

Data Control Language (DCL):

DCL queries are used to control access and permissions to the database. Examples include:

  • GRANT: Provides privileges and permissions to users.
  • REVOKE: Revokes privileges and permissions from users.

Data Query Language (DQL):

DQL queries are used to retrieve and query data from the database. The most common DQL query is:

  • SELECT: Retrieves data from one or more tables based on specified conditions.

--

--

BharteeTechRubyOnRails
BharteeTechRubyOnRails

Written by BharteeTechRubyOnRails

Ruby on Rails Developer || React Js || Rspec || Node Js

No responses yet