first of all, what is MySQL? (This is a link) stores the Data Warehouse, has its own command language (SQL statement, a non-procedural language), is widely used in small and medium-sized web sites on the Internet, small size, fast, low cost, but also open source.
History can be traced back to before I was born (there are several big companies in between the tearing of the story and the legendary life of their own to see it) ... was acquired by Sun, and then sun was acquired by Oracle (Oracle). Anyway, no matter in whose hand, the product is a good product. (This is a link)
Second, the SQL statement is to the database, table, table information and other changes
* DDL :D ata definition Language. Data definition language. * Create, alter, drop ... * DML :D ata manipulation Language. Data processing language. * update, INSERT, delete ... * DCL :D ata control Language. Data controls language. if , Grant ... * DQL :D ata query Language. Data queries language. * Select
Note : The writing order of 1.select query statements:S ... F... W... G... H... O .....
Order of execution of the 2.sql statement: F ... W... G... H... S ... O...
For SQL statements in the query (select) as the focus of a separate list, priority MySQL is a relational database, tables and tables have a relational representation: one-to-many, many-to-many. Then the way of querying data will be divided into single-table query and multi-table query, on the basis of a single table query, Multi-table query increases learning cost
A one-to-many table of principles: Create a field on many sides, as the foreign key point to one side of the primary key, a pair of many relationships as follows:
* This one-to-many relationship is similar to the ancient emperor, he can have a lot of concubine, but these concubines belong to this emperor create table King (int primary KEY auto_increment, < primary key > dname varchar),create TABLE Rani ( int primary KEY auto_increment, < primary key > name varchar (+), int, < The inner key constraint method binds the concubine's name to the Emperor's ID > foreign Key (name) references King (ID) ) ;
There is also a way to connect a foreign key:
* This one-to-many relationship is similar to the ancient emperor, he can have a lot of concubine, but these concubines belong to this emperor create table King (int primary KEY auto_increment, < primary key > dname varchar),create TABLE Rani ( int primary KEY auto_increment, < primary key > name varchar (+), int, ); * ALTER TABLE Rani add foreign key (age) references King (ID);< FOREIGN KEY constraint way
since it is the warehouse where data is stored, what does it have to do with our Java? What is the connection method?
This requires our Java datebases Connection (JDBC) to connect
A brief analysis of MySQL