SQL basic overview

DBMS categories:
  • Hierarchical database HDB
  • Object-oriented database OODB
  • XML database XMLDB
  • Key-value storage system KVS
  • Relational database RDB
RDBMS (relational database management system), the main kind 5:
  • Oracle Database
  • SQL Server
  • DB2
  • POStgreSQL
  • MySQL
SQL statements and types
  • DL (Data Definition Language, Data Definition Language): used to create or delete a database and table objects in a database for storing data. It includes the following command:
    • CREATE: create databases and tables and other objects
    • DROP: delete databases and tables and other objects
    • And modify the database table structure like objects: ALTER
  • DML (Data Manipulation Language, database manipulation language): used to query or change records in the table. It includes the following instructions:
    • SELECT: The data look-up table
    • INSERT: insert new data into the table
    • UPDATE: with the new data table
    • DELETE: Delete exemplar data
    DCL (Data Control Language, a database control language): used to confirm or cancel the changes to the data in the database, in addition to the user also can RDBMS (relational database management system) whether there is authority to operate the database objects set . It includes the following instructions:
    • COMMIT: confirmation of the data in the database will be with
    • ROLLBACK: the removal of data in the database changes
    • GRANT: gives user rights
    • REVOKE: cancel the user's operating authority
Data typing
  • Of INTEGER : store integers, decimals can not be saved
  • CHAR : the CHARACTER (character) abbreviation for the character designated storage, such as can be specified length: char (10) is longer than a specified length and can not enter the column
    • Note: The byte data unit inside a computer, typically a character requires 1-3 bytes to represent.
    • Storage form: CHAR type column string stored in the form of fixed-length string specified in.
    • A fixed length string: the length of the column can not achieve the maximum length, half-size spaces for the use of complement.
  • VARCHAR : CHAR and used as specified storage column of the string, which can be specified length VARCHAR (64),
    • The variable-length character string type in the form of a character string to hold
    • Variable length strings: even when the number of characters does not reach the maximum length, is not made up with a half-size space.
    • Note: VAR is varing (variable abbreviation)
  • VARCHAR2 : Use this type in the Oracle

  • DATE : date to the specified storage

Guess you like

Origin www.cnblogs.com/sanzashu/p/11016403.html