Rookie rise DB Chapter 1 Database overview

Source: Internet
Author: User
Tags db2 odbc one table access database

1. Overview of the database

at this stage , if the data is to be stored and managed , the database is inseparable. When data is stored in a database, the data is organized and managed through a database management system. A database consists of an ordered set of data that is stored in a structured data table. The data tables are interrelated and reflect the essential relationship between the objective things. The database system phase provides security control and integrity control over the data.

The development stage of 1.1 data management technology

so-called data management refers to the classification, organization, coding, storage, retrieval and maintenance of various kinds of data. to the present, the database management technology has undergone three stages, namely the artificial management stage, the file system stage and the database system stage.

1.1.1 Manual Management Phase

Before The middle of the decade. Since the hardware in the computer does not have a hard disk like the present, the software does not have the software to manage the data, so the computer is limited to science and technology, and the data is only carried by the program that calculates and processes it. This period is called the artificial management stage.

The human management phase features the following:

L data cannot be stored for a long time.

L The program itself manages the data.

L data cannot be shared.

L data is not independent.

1.1.2 File system phase

with the development of technology , in the late century to mid-decade , computers are applied not only to science and technology , and began to be used for management. In this period due to the computer hardware appeared hard disk, computer software appeared high-level language and operating system, so the program and data has a certain independence, the emergence of program files and data files, this is called the file system phase.

The file system phase is characterized by the following:

L data can be stored for a long time

L data is managed by the file system.

L Large data redundancy and poor sharing.

L Poor data independence.

1.1.3 Database system phase

with the development of network technology, computer software and hardware functions of the progress, in the late years of the year , the computer can manage large-scale data, when the computer also uses a file system to manage data, Can not meet the needs of various applications at that time, so there are database technology, especially relational database technology. This phase is called the database system phase.

The database phase features the following:

• data is structured.

• data sharing is achieved.

L Strong data independence.

L data granularity becomes smaller.

1.1.3.1 The stage of database technology experience

in the database system Management data stage, over time, has undergone 3 technical stages, namely: Hierarchical database and Mesh database technology stage, relational database technology stage, different kinds of databases according to different data structure to contact and organize.

Concepts involved in the 1.2 database system phase

Databases (databaseDB) : Refers to a collection of data that is stored on a computer for a long time and is organized in accordance with certain rules, which can be shared by various users and managed uniformly.

Database management System ( Database Management System DBMS): A large-scale software that operates and manages databases for the establishment, use, and maintenance of databases, unified management and control of databases to ensure database security and integrity. Users manage and Access data in the database through a database management system. Currently, the most popular and commonly used database management systems are Oracle,MySQL,sql Server , DB2 , and so on.

Database Systems (DBsystem DBS) Refers to the system of introducing a database into a computer system , which is usually composed of computer hardware, software, database management system and Data Administrator.

Usually the database is used to represent the database software we use, specifically, the database software should be a database management system.

database Application (DataBase application) : Although there is already a DBMS, but in many casestheDBMS is unable to meet the requirements for data management. Database applications can be used to meet the higher requirements for data management and to make the data management process more intuitive and friendly. The database application is responsible for communicating with the DBMS , accessing and managing the data stored in the DBMS , allowing the user to insert, delete, and modify data in the DB.

Table ( Table): In a relational database, a database table is a collection of two-dimensional arrays used to store the logical structure of data and manipulation data. It consists of a vertical column and a horizontal row, which is called a record, is the organization of the data, and the column is called a field, and each column represents a property of the record, with corresponding descriptive information, such as data type, data width, and so on. A data table consists of a table name, a field in a table, and a record of three parts of a table. Designing a data table structure is defining a data table file name, determining which fields the data table contains, field names for fields, field types, and widths, and entering the data into your computer. database table names are unique in a database.

Data Type : Data types determine the format in which data is stored on your computer and represent different types of information. Common data types are: Integer data type, floating-point data type, exact decimal type, binary data type, date / time data type, string data type.

PRIMARY KEY ( PRIMARY KEY): Also known as the main code, used to uniquely identify each row of records in a table. You can define one or more column primary keys in a table, and a primary key cannot be a null value. PRIMARY KEY constraint : non-null , unique , referenced ( foreign key ) , the value of the primary key column cannot be NULL, and cannot be repeated! Specifies that the PRIMARY KEY constraint uses the PRIMARY key keyword .

1.3 Database technology composition

in short, the database consists of hardware and software, hardware including computers, storage devices and so on. The software section includes the DBMS, The operating system that supports the DBMS, and the access technologies that support the application development in multiple languages.

1.3.1 Database system

The database system consists of three components:

L Database

L Database management system (Management)

L database application (DBapplication)

1.3.2 SQL language

The language of querying and modifying the database is called SQL. The meaning of SQL is Structured Query language (structured Query Language).

1.3.2.1 SQL classification

There are many different types of SQL, with 3 main criteria:

L ANSI(American National standard)SQL;

L SQL-99

The SQL standards provided by major database vendors , including the original ANSI SQL, are expanded on this basis, which we call private statements for the database.

1.3.2.2 Four part of the SQL component

The SQL language consists of the following four sections:

L DDL(data definitionLanguage): Defines a database object: libraries, tables, columns, etc.;

DML( data Manipulation Language): Data manipulation language used to define database records;

L DCL(Data Control Language): The language used to define access rights and security levels;

L DQL(data queryLanguage): The language for querying data.

1.3.2.3 SQL syntax requirements

SQL Syntax Requirements

The SQL statement can be written in single or multiple lines, ending with a semicolon;

L can use the space and indentation to enhance the readability of the statement;

L keyword is not case-sensitive, it is recommended to use uppercase;

1.3.3 Database access interface

different programming languages will have their own different database access interfaces to perform SQL statements for database management. The main database interfaces have the following parts:

1.3.3.1 ODBC

Odbc: Open Database Interconnect (Open Database Connectivity) is a standard for Microsoft's approach to implementing communication between applications and relational databases, and is an interface standard. So it's actually a standard, a database that conforms to the standard can beSQLThe commands written by the language manipulate the database, but only for the relational database (for example,SQL Server,Oracle,Access,Exceland so on, all current relational databases are compliant with this standard. ODBCessentially a set of database accessesAPI(Application Programming Interface), composed of a set of function calls, the core isSQLstatement.

a based onODBCwhen the application operates on a database, the user directlySQLstatement is routed toODBC, whileODBCThe operation of the database does not depend on anyDBMS, not directly withDBMSall database operations are handled by the correspondingDBMSof theODBCThe driver is completed by the correspondingDBMSof theODBCDriver forDBMSto operate. In other words, whether it isFoxPro,Accessor isOracledatabase, all availableODBC APIfor access. This shows thatODBCThe biggest advantage is the ability to handle all relational databases in a unified manner. See figure in detail1is shown.

in a specific operation, you must first use the The ODBC Administrator registers a data source, and the manager establishes a link between ODBC and a specific database based on information such as the database location, database type, and ODBC driver provided by the data source . This allows ODBC to establish a connection to the corresponding database as long as the application provides the data source name to ODBC .

but direct useODBC APImore trouble, so Microsoft later developedDAO,RDO,ADOThese database interfaces make it easier to develop programs using these database interfaces. These interfaces all supportODBC, so even if the database you are accessing does not provideADOthe drive, as long as there isODBCdrive can be used asADOfor access. But by the figure2can be seen,ODBCis actually a fairly low-level access technology, so it can set up and control the database from the bottom, and do some of the functions that advanced database technology cannot accomplish.

1.3.3.2 JDBC

Java Data Base Connectivity (Java database connection ) is the standard way for Java applications to connect to a database. is a way to perform SQL Statement of Java API, can provide unified access to multiple relational databases , It is used by a group of Java languages are composed of classes and interfaces.

1.3.3.3 ADO

ADO is A set of object-oriented class libraries that Microsoft has developed and designed to interact with data sources in the. NET framework. ADO provides access to relational data,XML , and application data, allowing interaction with different types of data sources and databases.

1.3.3.4 PDO

The PDO(php Data Object) defines a lightweight, consistent interface for the PHP Access database, which provides a data access abstraction layer so that No matter what database you use, you can execute queries and get data through consistent functions. PDO is A major feature of PHP5 's new addition.

For different programming languages, different database access connection drivers are provided in the database, and we can download the relevant drivers according to the language when we use them.

1. 4 Common Databases

L Oracle: Oracle;

L DB2:IBM;

L SQL Server: Microsoft;

L Sybase: sales guy;

L MySQL: Oracle;(Oracle acquires SUN)

1. 5 Understanding the Database

What we're talking about now is a database of shut -down databases (rdbms-relational database management system), or " Database server.

Once we have installed the database server, we can create the database in the database server, and each database can contain more than one table.

A database table is a multi-row, multi-column table. When you create a table, you specify the number of columns in the table, as well as information such as column names, column types, and so on. Without specifying the number of rows in the table, there is no limit to the number of rows. Here is the structure of the Tab_student table:

Once you've created the table, you can add data to the table. Adding data to a table is in the behavioral unit! The following is a record of the s_student table:

s_id

S_name

S_age

S_sex

s_1001

Zhangsan

23

Male

s_1002

LiSi

32

Female

s_1003

Wangwu

44

Male

We must learn to differentiate what is a table structure and what is a table record.

1.5.1 table Structure

A data table consists of a table name, a field in a table, and a record of three parts of a table. Designing a data table structure is defining a data table file name, determining which fields the data table contains, field names for fields, field types, and widths, and entering the data into your computer.

1. 6 Applications and Databases

The application uses the database to complete the storage of the data!

Rookie rise DB Chapter 1 Database overview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.