40th day of walking into the computer (database 1)

Source: Internet
Author: User

What is a database

A database is a place where data is stored, which is a collection of data that can be shared by the organization over a long period of time.

The data of the database is organized, described and stored according to certain mathematical model, with small redundancy and high extensibility, and sharing

Two database management system software

The database Management system is a large software that manipulates and manages databases, used to establish, use, and maintain databases, referred to as DBMS.

It manages and controls the database uniformly to ensure the security and integrity of the database. The user accesses the data in the database through the DBMS, and the administrator in the database maintains the data through the DBMS.

It allows multiple applications and users to create, modify, and interrogate databases in different ways, at the same time or at different times. Most DBMS provides data definition language (Language) and data-manipulation language (manipulation Language), which allows users to define schema structure and permissions constraints of the database, to append the data, Delete operations.

Database management system is the core of database system and the software of managing database. Database management system is to realize the user's meaning of abstract logical data processing, transformation into a computer-specific physical data processing software. With a database management system, users can manipulate the data in an abstract sense without having to take into account the layout and physical location of the data in the computer.

Three database classification

Relational database: MYSQL, 0racle, SQL Server, DB2, SQLite,

Non-relational database: Redis, MongoDB

Four SQL statements: structured statements

Spec: 1 case insensitive,

2 with a semicolon as the ending symbol,

3 Notes--/* * *

Five database operations

Show DATABASES;--View all databases

Create database name;--Creating database

Show create database name;--View Creating database Information

Use database name;---using a database

Operation of six data tables

---create a table

CREATE Table Table name (

field firstname data type [constraint],

field firstname data type [constraint],

field firstname data type [constraint],

。。。。。

field firstname data type [constraint]

End

Primary key (primary key): Non-null and unique

NOT NULL: non-null constraint

Unique: Single constraint

Seven basic operations for modifying tables

Add Column (field)

ALTER TABLE Tab_name add[column] Column name type [integrity constraint] [first | after field name];

Modify a column type

ALTER TABLE tab_name Modify column name type [integrity constraint] [first | after field name];

Modify column names

ALTER TABLE TAB_NAME change [column] columns name new column name type [integrity constraint] [first |after field name];

Delete a column

ALTER TABLE Tab_name drop [column] name;

Modify Table Name

Rename table name to the new name;

Modify all character sets of a table

ALTER TABLE student character set UTF8;

View Table

DESC TABLE_NAME View Table structure

Show columns from tab_name view table structure

Show tables View all tables in the current database

Show create TABLE table name view current database table Table statement

Delete a table

DROP table Name

40th day of walking into the computer (database 1)

Related Article

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.