Database role: Storage data MySQL relational database management system, developed by the Swedish MySQL AB company, currently belongs to Oracle Corporation. Current Mainstream database: Microsoft: Aqlserver accessoracle:oracle mysql JAVAIBM company: Db2sybase Company: Sybase-jtmycql-uroot-p installation Complete or not net start Mycqlnat Stop mycqlservises.mscshow databases;//show those libraries created database; Create library drop database name; Delete CREATE TABLE: Create table indicates (field name type); Alter TA ble student Add Address .... ALTER TABLE library name dropalter Table Change index: Create Idex name on table (column name) Delete index: Alter table< storage form in table name > drop database 1. Hierarchical Model 2, mesh model 3. Relationship model (emphasis) has ause ais a DECIMAL database integrity: Prevent garbage data from generating primary KEY constraints: CREATE TABLE student (stu_id INT PRIMARY key Auto_increment,stu_nam e varchar () not null,stu_gender INT CHECK (stu_gender=1 or stu_gender=0), stu_address VARCHAR (), Stu_class) Association: Delete, First delete accessory 1v1:---Unique foreign key association (the foreign Key design is designed on any string, but there is a unique constraint)---Primary KEY Association 1-to-many: foreign key must design hair oh many-to-many; foreign key design in Jian SQL statement 1 、---DDL: Data definition language (set delete modify, ttable Modify, delete table structure) (Database Designer)---DQL: Query statement---DML: Adding and deleting statements---DCL: Control languageadd: INSERT into indicates (column name) values (value)Change: Update indicates set column = new value where filter conditionDelete : Delete from table name where filter conditionCheck: Projection: Select Fromselect + (DISTINCT) + from table name where condition order BY column 1 column 2 is not recommended with SELECT * Query all, so inefficient concat can connect string concat (column 1, ' + '). column, Name 2) distinct: Used to exclude duplicate row data limit: limits to see how many bars, 0,10where and and or or between and (greater than or equal to the downline and less than equals on-line) specify a value, column name in () where column like '% Represents 0 to any _ represents a word is null or is not NULL to determine whether the column is empty ORDER by + column: Sort columns by default (ASC) Ascending and DESC descending 1, from the club of Roma defender 2, Manchester United Club has a horse word player 3, the name of the bar with the furniture Music department and position 4, the player from Manchester United's Center 5, the same day born players aggregate function: Count: Counts the number of rows select count () from* all indicates the specified statistic column non-null value row number aidtinct exclude duplicates sum: Column value sum no *; Avg: Column Average no * max: max min: Minimum group by Packet having + filter (group after filter:::: Where before Group filter) multi-table action subquery: Nested query in query select nested in main query: low efficiency Subqueries nested in select are inefficient, and in real-world development use table joins as much as possible instead of nested subqueries in the From: Multi-line multi-column while nested single-row innot in single-row all operator: compare one by one, Full satisfaction satisfies the any operator: one satisfies, satisfies the condition exsits exists not exsts does not exist combinatorial query union
Database Simple Total