Skip to content

Latest commit

 

History

History

SQL Language

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Major differences between SQL and other programming languages:-

  1. SQL is more based on the desgin logic.
  2. SQL focuses on grouping while other programming languages focuses more on the procedure.

Important terms of SQL

  1. schema - the basic database structure of the software.
  2. Table - The tables present within each schema.
  3. Column - The different types of columns within table.
  1. Basic Syntax:

    • SQL statements are written in a declarative language.
    • Common statements include SELECT (retrieve data), INSERT (add data), UPDATE (modify data), DELETE (remove data), and more.
  2. Data Types:

    • SQL supports various data types such as INTEGER, VARCHAR, DATE, etc. Understanding data types is crucial for creating tables and defining columns appropriately.
  3. Tables and Databases:

    • Data in SQL is organized into tables, and tables are organized into databases.
    • A database is a collection of related tables, and each table consists of rows and columns.
  4. Normalization:

    • Normalization is a process to organize the data in a database efficiently, eliminating data redundancy and dependency.
  5. Primary Keys:

    • A primary key is a unique identifier for a record in a table. It ensures that each record can be uniquely identified.
  6. Foreign Keys:

    • A foreign key is a field in a table that refers to the primary key in another table. It establishes a link between the two tables.
  7. Indexes:

    • Indexes are used to optimize query performance by speeding up data retrieval. They are created on columns to facilitate faster data access.
  8. Joins:

    • Joins are used to combine rows from two or more tables based on a related column between them. Common types include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.
  9. Aggregate Functions:

    • SQL provides aggregate functions like COUNT, SUM, AVG, MAX, and MIN to perform calculations on sets of values.
  10. SQL Constraints:

    • Constraints are rules enforced on data columns to maintain the integrity of the database. Examples include NOT NULL, UNIQUE, CHECK, and DEFAULT constraints.
  11. Transactions:

    • SQL supports transactions to ensure data consistency. Transactions are sequences of one or more SQL statements that are executed as a single unit.
  12. Views:

    • Views are virtual tables derived from one or more base tables. They can simplify complex queries and provide a layer of abstraction.
  13. Stored Procedures and Functions:

    • SQL allows the creation of stored procedures and functions, which are precompiled and stored in the database for reuse.
  14. Security:

    • SQL databases have security features such as user authentication and authorization to control access to data.
  15. ACID Properties:

    • Transactions in SQL adhere to ACID properties: Atomicity, Consistency, Isolation, and Durability, ensuring reliability and data integrity.
  16. Backup and Recovery:

    • Regular backups of databases are essential for data recovery in case of hardware failure, data corruption, or accidental deletion.
  17. SQL Standards:

    • SQL is a standard language, but different database management systems (DBMS) may implement it with slight variations. Understanding these differences is important when working with specific database systems like MySQL, PostgreSQL, SQL Server, or Oracle.