What is the multi-table joint query statement in mysql
The multi-table joint query statement in mysql is: [select statement 1 union [union option] select statement 2 union [union option] select statement n]. The result of multi-table joint query is to combine the query results of multiple select statements. 【Related learning recommendation: mysql tutorial(video)】 Mysql multi-table joint query statement is: The joint query result is to combine the query results of multiple select statements together. You can use the union and union all keywords to merge. Basic syntax: select statement 1 union [union option] select statement 2 union [union option] select statement n The union option has two options: all (repeat and output); distinct (deduplication , completely repeated, will be deduplicated by default) The fields of the two tables should be the same. Example: select id,addrid from addr union all select id,addrid from student The meaning of joint query 1. Query the same table, but the requirements are different 2. Multi-table query: The structure of multiple tables is exactly the same, and the saved data (structure) is also the same Use of joint query order by In joint query: order by can only use one last, Parentheses are required for query statements. Example: —(mistake) select * from student where sex=”man”…
How to use MySQL foreign key
Methods of using MySQL external keys: 1. The two tables must be InnoDB table types; 2. The domain used in the foreign key relationship must be an index type Index; 3. The domain used in the foreign key relationship must be of the same data type resemblance. 【Related learning recommendation: mysql tutorial(video)】 Methods of using MySQL external keys: 1. Only InnoDB tables can use foreign keys. Mysql defaults to MyISAM, which does not support foreign key constraints 2. The benefits of foreign keys: it can make two tables associated, ensure data consistency and realize some cascading operations. 3. The role of foreign keys: To maintain data consistency and integrity, the main purpose is to control the data stored in foreign key tables. To associate two tables, the foreign key can only refer to the values of the columns in the foreign table. 4. The prerequisite for establishing a foreign key: The two tables must be of the InnoDB table type. The field used in the foreign key relationship must be an index type (Index). The field used in the foreign key relationship must be similar to the data type. 5. Steps of creation Specify the primary key keyword: foreign key…
How to modify the MySQL field to capitalize the first letter
The method of modifying the first letter of the MySQL field: first use LEFT to take out the first letter alone and use UPPER to replace it with uppercase; then determine the length of the field, and use SBUSTRING to take out all the fields from the second to the end for backup; then Use CONCAT to connect the two values above; finally, modify the value of the update table field. The above is the detailed content of how to modify the MySQL field to capitalize the first letter. For more information, please pay attention to other related articles on 1024programmer.com!
How to deal with 1045 error in mysql database
The solution to the 1045 error in the mysql database: first find the [my.ini] file under the MySQL installation path, and open it with Notepad; then find the location of mysqld; then add the statement [skip] under [mysqld] -grant-tables]; save it at last. The above is the detailed content of how to deal with the 1045 error in the mysql database. For more information, please pay attention to other related articles on 1024programmer.com!
How does mysql change the connection port
How to change the connection port of mysql: first log in to mysql; then use the command [show global variables like & # 39; port & # 39;;] to check the port number; then modify the port; finally restart mysql. 【Related learning recommendation: mysql tutorial(video)】 How to change the connection port of mysql: 1. Log in to mysql mysql -u root -p //Enter the password 2. Use the command show global variables like 'port'; to view the port number mysql> show global variables like 'port'; 3. Modify the port Edit /etc/my.cnf file, earlier version It may be the name of the my.conf file, add the port parameter, and set the port, note that the port is not used, save and exit. [root@test etc]# vi my.cnf [mysqld] port=3506 datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid “my.cnf” 11L, 261C written [root@test etc]# 4. Restart mysql [root@test ~]# /etc/init.d/ mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ] For more programming learning, please pay attention to the PHP training column! The above is the detailed content of how mysql changes the connection port. For more information, please pay attention to…

Where is the lib file of mysql
mysql php Write your review! Spit it out, see everything Member Login | User Registration recommended reading char MySQL InnoDB four transaction levels and dirty read, non-repeated read, phantom read_MySQL MySQLInnoDB transaction isolation level dirty read, repeatable read, phantom read MySQLInnoDB transaction isolation level has four levels, the default is repeatable read (REPEATABLE READ). · Read uncommitted (READUNCOM… [detailed] Crayon Shinchan 2023-08-26 13:36:59 char zabbix introduction and installation Introduction: The article is divided into 3 paragraphs 1. Zabbix introduction, including architecture, component workflow, etc. 2.zabbix installation, yum installation and compilation installation 3.zabbix… [detailed] Crayon Shinchan 2023-08-26 13:29:24
How to use enumeration type in mysql
How to use the enumeration type in mysql: 1. Insert data, the syntax is [insert into my_enum values (1), (2);]; 2. Error data, the syntax is [insert into my_enum values( & # 39; male & # 39;);]. Related learning recommendation: mysql tutorial How to use the enumeration type in mysql: Enumeration: enum, to achieve all possible results are designed, in fact, the stored data must be one of the specified data. How to use enumeration Definition: enum (list of possible elements); such as enum (‘male’ ,’female’) Use: store data, only the data defined above can be stored The meaning lies in: 1, the possibility of limiting the value! 2, fast, faster than ordinary strings! The reason is that the enumeration type is managed by integers, which can be managed by 2 bytes! Each value is an integer identifier, starting from the first option as 1, increasing one by one! Management in the form of integers, faster than strings! There are 2 bytes in total, 0-65535, so there are 65535 options available! 、 Create enumeration table create table my_enum( gender enum(‘Male’, ‘Male’, ‘Female’, ‘Confidential’) )charset utf8; The first function: standardize the data format, the data can only be one of the…
How does mysql verify whether the installation is successful
How to verify whether mysql is successfully installed: 1. Open the DOS window, enter the status command to view the MySQL version information; 2. Open the MySQL 5.7 Command Line Client program, open the current MySQL server status, and enter the relevant command to display the current MySQL server status. list of databases. The above is the detailed content of how to verify whether mysql is successfully installed. For more information, please pay attention to other related articles on 1024programmer.com!