Database and SQL language basics

concept

A database storage structure that allows a variety of input formats, data retrieval and processing, do not have to re-enter the data each time when needed.
Feature

  • Data sharing

  • Reduce redundant data

  • Data independence

  • Data centralized control

  • Data consistency and maintainability
    level

  • Physical data layers: the innermost database, the data set is actually stored on the physical storage device

  • The conceptual data layer: intermediate layer, when storing a collection of records

  • Logical data layer: the user can see and use the database, when a particular user or some data set, i.e. the set of logical records

Database types and functions

  • Hierarchical database: a tree-like structure, is a set of interrelated by linking together records.
  • Reticular database: using network data structure showing the logical structure of the entity type, the contact between the entities.
  • Object-oriented databases: object-oriented model is based on
  • Relational database :( most popular), based on relational model database, relational model is composed of a series of tables.

SQL language

SQL Structured Query Language, SQL can easily use the query, operation definitions, data, and control database.

Components: a data definition language, a data manipulation language, a data control language, transaction control language

select statement
used to retrieve data from the data table

The data in Table tb_emp names of all female employees, age retrieved in the form of age-ascending out:
the SELECT name, from tb_emp the WHERE Age Sex = 'female' the Order by Age;
insert statement to
insert new data into the table used to
insert the table name (field 1, field name 2, ...)
valuse (an attribute value, the attribute value 2, ...)
is inserted in the data to a data table tb_emp
insert into tb_emp valuse (2, ' lili', ' F', sales);

update statements
for certain records update the data in the table
assume that you want the data in Table tb_emp ages 2 employees revised to 24-:
update tb_emp the SET Age = 24-the WHERE the above mentioned id = 2;
the Delete statement
to delete data

The data in Table tb_emp numbered 1024 employees deletion:
the Delete from the WHERE tb_emp the above mentioned id = 1024;

Published 59 original articles · won praise 7 · views 7303

Guess you like

Origin blog.csdn.net/m0_46193982/article/details/105150912