Back to the fifth day of javaweb (three) (three paradigms and database backup) (multi-table query)

 

 

 You have to see if there is a connection between the two, in order to design the association of multiple tables

If there are n sheets, the number of contacts you need to check is:

 n!/2

 

 

 

 

 

 

 

 If you copy a lot of SQL statements from other places and find that they cannot be executed

So yourself: split it, because its formatting may be wrong when copying, just split it and use it.

 

 

 

 

 

 

 

For designing databases, following 3NF is already a good database.

 

 

 1 2 3NF I will

 

 

 

 Deleting graduated students will not affect the department name.

 

 

 

 

 To enter into mysql, there is a semicolon and no semicolon when writing sql statements

What mysqldump and the like are used, do not write semicolons.

 

 

 What is said here is that in the database, source XXX means: Which SQL statements are used to restore, and where are the statements used to restore.

 

Whether it is at the database level or the table level, in fact, its keywords do not change much, and you will also find that drop is relatively common.

Of course, at the database level, use the database keyword without anything else.

 

 

Database coding problem solving:

MySQL problem record-Incorrect string value: '……' for column '……' at row X

 

Then it must be an encoding problem, go to the command line to check the encoding of this database

show create database db1;

alter database db1 character set utf8;

alter table user character set utf8;

For the table, it can also be written as:

alter table user convert to character set utf8;

It means to change the encoding of this table.

But changing the encoding of the database has not necessarily changed the encoding of each table

Therefore, it is still necessary to change to the encoding of a specific table.

For encoding issues, the first consideration is whether there is a problem with the encoding of the database, rather than whether there is a problem with the source code of the copy.

 

 If sqlyog, then the following shows.

 

The purpose of multi-table queries: to eliminate useless data.

 

 

 

 

 

 

 

 In the future, when writing a database, a field is often written in a line, which is convenient for adding comments

Then the keyword should be written on a separate line.

 

 

Because from where select this is the order!

So the aliases are placed after from, and they can be used after where and select.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Nested subqueries must be enclosed in parentheses.

 

The subquery is used as a condition. If it is a single-row single-column query result , the subquery can be used as one of the elements of this operator.

 

 

 

Guess you like

Origin www.cnblogs.com/startFrom0/p/12706929.html