SQL statements

SQL, Structured query language, is a formal, non-procedural programming language used to create, modify, and manipulate data in an arbitrary relational database managed by an appropriate database management system (DBMS).

SQL statements

Data Definition Language (DDL) statements:

  • CREATE creates a database object (database, table, view, user, etc.)
  • ALTER modifies the object
  • DROP removes the object

Data Manipulation Language (DML) operators:

  • SELECT selects data that meets the specified conditions
  • INSERT adds new data
  • UPDATE modifies existing data
  • DELETE deletes data

Data Control Language (DCL) statements:

  • GRANT grants the user (group) permissions for certain operations with the object
  • REVOKE revokes previously issued permissions
  • DENY specifies a deny that takes precedence over permission

Transaction Control Language (TCL) statements:

  • COMMIT applies a transaction
  • ROLLBACK rolls back all changes made in the context of the current transaction
  • SAVEPOINT splits the transaction into smaller ones

NULL in SQL

NULL is a special value (pseudo-value) that can be written to a field in a database table. NULL corresponds to the concept of "empty field", that is, "a field that does not contain any value."

NULL means absence, unknown information. A NULL value is not a value in the full sense of the word: by definition it means no value and does not belong to any data type. Therefore, NULL is not equal to the Boolean value FALSE, nor the empty string, nor 0. Comparing NULL with any value will result in NULL, not FALSE and not 0. Moreover, NULL is not equal to NULL!

Temporary tables

Temporary table is a database object that is stored and managed by the database system on a temporary basis. They can be local or global. Used to store the results of a stored procedure call, reduce the number of rows on joins, aggregate data from different sources, or as a replacement for cursors and parameterized views.

View

View - virtual table representing data from one or more tables in an alternative way.

In reality, a view is just the result of a SELECT statement, which is stored in a memory structure that resembles an SQL table. They work in queries and DML statements just like the main tables, but do not contain any data of their own. Views greatly expand your data management capabilities. This is a way to give public access to some (but not all) of the information in a table.


Read also:


Comments

Popular posts from this blog

Methods for reading XML in Java

XML, well-formed XML and valid XML

ArrayList and LinkedList in Java, memory usage and speed