RDBMS: relational database management system
1, database creation, deletion
2. Create a table, delete a table, modify a table
3. Creation and deletion of indexes
4. Users and Permissions
5. Data increase, deletion, change
6. Enquiry
DML: Data Manipulation language
Insert, replace, UPDATE, delete
DDL: Data Definition language
Create, ALTER, drop
DCL: Data Control Language
GRANT, REVOKE
Dbms:
Data management Independence
Effectively complete data access
Data integrity and security
Centralized data management
Concurrent storage and failure recovery
Reduce application Development Time
Syntax analysis
-->sql commands such as applications or users
||
Analyzer |
Plan Actuator |
Optimizer |
Transaction manager |
How files are accessed |
Recovery Manager |
Cache device |
Lock Manager |
Disk space Manager |
Package format
Package Manager-specific formats
RPM package, EXE format, etc.
Universal binary Format
SOURCE program
Tcp/3306,mysql user, MySQL group, installed by default in/var/lib/mysql
MySQL Client
Interactive mode
Batch mode: Execute MySQL Script
Command categories in interactive mode: Client commands and server-side commands. The server-side command must use the statement terminator, which defaults to a semicolon
Relational database objects: tables, indexes, views, constraints, stored procedures, stored functions, triggers, cursors, users, permissions, transactions
The key and main is: Table Table branch row and column field/column, table must have at least one column
Data type
Character:
CHAR (n)
varchar (n) Variable length
Binary (n) case-sensitive, national length
varbinary (n)
Text (n) literal large object, clear description of storage length
BLOB (n) binary large object
Numerical:
Exact values
Shaping modifier: Unsigned unsigned, NOT NULL
tinyint
smallint
Int
bigint
Decimal
Decimal
Approximate values
Floating point Type
Float
Double
Date Time
Date
Time
Datetime
Stamp
Boolean
Creating the database: Create databases [if not EXISTS] db_name;
Display database: show databases;
Delete databases: drop database [if not EXISTS] db_name;
Creating tables: Create TABLE Tb_name (Coll,col2 ...);
View table: Show tables from Tb_name;
View table structure: desc tb_name;
Modify table: ALTER TABLE Tb_name
Modify: Modifying properties
Change: Modify Name
Add: Adding
Drop: Delete
Help alter table--for assistance.
Insert data: INSERT INTO Tb_name (Col1,clo2 ...) values|value (' string ', num ...);
Replace into replacement
Modified data: Update tb_name set com= ' value ' where col1= ';
Delete data: Delete from Tb_name where
Choose
The Select field from the tb_name where condition;
*: Denotes all fields
Where: no where means all rows
Created by: Create user ' username ' @ ' host ' identified by ' password ';
Delete users: Drop user ' username ' @ ' host ';
User authorization: Grant permission on Db_name.tb_name to ' username ' @ ' host ' [identified by ' Password '];
View User rights: Show grant for ' username ';
Set a password for a user
1, set password for ' username ' @ ' host ' =password (' password ');
Flush privileges;
2, #mysqladmin-uusername-hhost-p PASSWORD ' PASSWORD ';
3. Update user set Password=password (' Password ') where user= ' username '
Forum
Discuz
Phpwind
phpBB
Cms
Drupal
Joomla
WordPress Personal Blog System
This article is from the "ngames" blog, make sure to keep this source http://ngames.blog.51cto.com/3187187/1562164
MySQL preliminary, data types and SQL statements