SQL: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 14: Line 14:
SQL statements define the necessary inputs and outputs for the database interaction, but it does not define how the statements should be executed. The details of the execution are left to the database engine component known as the '''optimizer'''.
SQL statements define the necessary inputs and outputs for the database interaction, but it does not define how the statements should be executed. The details of the execution are left to the database engine component known as the '''optimizer'''.


=Terms=
=<span id='Table'></span>Relational Database Terminology=
==<span id='Table'></span>Relational Database Terminology==
In a relational model, data is stored in a set of [[Relational_Databases#Table_(Relation)|tables]], also known as [[Relational_Databases#Table_(Relation)|relations]]. Within a relation, data is organized in [[Relational_Databases#Row|rows]] ([[Relational_Databases#Record_(Row)|records]]) and [[Relational_Databases#Column|columns]]. Each row describes an [[Relational_Databases#Entity|entity]]. Each is uniquely identified by a [[Relational_Databases#Primary_Key|primary key]]. The rows may contain columns that are copies of other tables' primary keys. These are knowns as [[Relational_Databases#Foreign_Key|foreign keys]] and are used in [[SQL_Querying_Multiple_Tables#Join|joining]] related data together.
In a relational model, data is stored in a set of [[Relational_Databases#Table_(Relation)|tables]], also known as [[Relational_Databases#Table_(Relation)|relations]]. Within a relation, data is organized in [[Relational_Databases#Row|rows]] ([[Relational_Databases#Record_(Row)|records]]) and [[Relational_Databases#Column|columns]]. Each row describes an [[Relational_Databases#Entity|entity]]. Each is uniquely identified by a [[Relational_Databases#Primary_Key|primary key]]. The rows may contain columns that are copies of other tables' primary keys. These are knowns as [[Relational_Databases#Foreign_Key|foreign keys]] and are used in [[SQL_Querying_Multiple_Tables#Join|joining]] related data together.



Revision as of 22:02, 22 May 2024

External

Internal

Overview

This article documents standard SQL. For database-specific extensions, we'll link to the databases-specific DML operations page.

SQL is a standard non-procedural language designed to work with relational databases, allowing the users to interact with the database instance by issuing schema statements, data statements and transaction statements.

SQL statements define the necessary inputs and outputs for the database interaction, but it does not define how the statements should be executed. The details of the execution are left to the database engine component known as the optimizer.

Relational Database Terminology

In a relational model, data is stored in a set of tables, also known as relations. Within a relation, data is organized in rows (records) and columns. Each row describes an entity. Each is uniquely identified by a primary key. The rows may contain columns that are copies of other tables' primary keys. These are knowns as foreign keys and are used in joining related data together.

Also see:

Relational Databases

Result Set

The result of an SQL query. It is logically equivalent with a non-persistent table.

View

SQL Schema Statements (DDL)

CREATE

CREATE TABLE

ALTER TABLE

SQL Data Statements (DML)

Refactor PostgreSQL DML Operations and surface in "Standard SQL" everything that can be handled with standard SQL.

INSERT

UPDATE

UPDATE WHERE

DELETE

DELETE WHERE

Queries with SELECT

Queries with SELECT

SQL Transaction Statements

Transactions.

Data Types

  • SQL data types
  • Database-specific data types
  • Working with different data types
  • Conversion functions

SQL NULL

NULL in conditions.

Indexes

Constraints

Set Operations

SQL Conditional Logic