day01: Database and SQL Overview

First, the benefits of database

1, data persistence

2, complete management system of unified management, easily accessible

 

Second, the concept of the database

Database: (database) DB, storing data warehouse that it holds a range of data organized

 

Database management system: (Database Management System) DBMS, is a kind of manipulation and management of large-scale database software used to create, use and maintenance of the database, referred to as DBMS. It unified database management and control, in order to ensure the security and integrity of the database

 

Structured Query Language: (Structure Query Language) SQL, designed to communicate with the database language

 

Third, database management system

A database management system is capable of providing data entry, modify, query the operating software data, having a data definition, data manipulation, data storage and management, maintenance data, communications and other functions, and is capable of allowing multiple users.

 

Common database management system: MySQL , the Oracle, the DB2, SQL Server , etc.

 

Four, SQL language overview

SQL is a standard computer language used to access and manipulate database

 

What is SQL?

  SQL refers to the structured query language
  SQL gives us the ability to access the database
  SQL is an ANSI standard computer language
Note: ANSI, the American National Standards Institute

 

What SQL you can do?

  SQL database for performing add, delete, change, search operation (including the operation of the database, and database tables)

 

Fifth, the characteristics of the database

 

(1) data sharing.
    It contains all the user data sharing access to data in the database, but also can include a user interface in various ways by the database, and provide data sharing.


(2) reduce the data redundancy.
    Compared with the file system, because the database to achieve the data sharing, thus avoiding the user build their own application files. It reduces the amount of duplicate data, reduce data redundancy, maintain data consistency.


Independence (3) data.
    Independence of the data include the logical structure of the database and the application database independent, but also include changes in the physical structure of the data without affecting the logical structure of the data.


(4) centralized data control.
    Document management, the data are in a dispersed state, the same user or different users in different treatments between unrelated files. Use database data can be centralized control and management, and that the link between the various data organization and data through the data model.


(5) data consistency and maintainability to ensure the safety and reliability of the data.
    They include: ① security control: to prevent data loss, unauthorized use and update error;
         ② integrity control: to ensure accuracy, effectiveness and compatibility of data;
         ③ concurrency control: in the same time period, allowing data achieve multiple access, but also to prevent the normal interaction between the user;
         discovery and fault recovery ④: provide a method by the database management system, to detect faults and fault repair, thereby preventing data corruption


(6) Recovery.
    The method provided by the set of database management system, to detect faults and fault repair, thereby preventing data corruption. The database system can recover as soon as possible failure of the database system is running, it may be wrong physically or logically. Such as misuse of the system due to data errors.

 

Six, SQL language classification

1, DML (Data Manipulation Language): data manipulation statements, used to add, modify, delete, query the database record and checks data integrity

2, DDL (Data Definition Language): data definition statements used to create database and tables, modify, delete

3, DCL (Data Control Language): data control statements to define user access rights and full level

 

Seven, DML

DML is used to query and modify data records, including the following SQL statement:

  insert: add data to the database

  update: modify data in the database

  delete:删除数据库中的数据

  select:查询数据库中的数据

 

八、DDL

DDL用于定义数据库的结构,如创建、修改或删除数据库对象,包括的SQL语句如下:

  create  table:创建数据库表

  alter  table:更改表结构、添加、删除、修改列长度

  drop  table:删除表

 

九、DCL

DCL用来控制数据库的访问,包括如下SQL语句:

  grant:授予访问权限

  revoke:撤销访问权限

  commit:提交事务处理

  roliback:事务处理回退

  savepoint:设置保存点

  lock:对数据库的特定部分进行锁定

 

Guess you like

Origin www.cnblogs.com/wuguiyu/p/11353454.html