New features such as views, stored procedures, and triggers are added to MySQL 5. Many of them are described.
One of them is called the store function, which is a bit like the stored procedure, but the returned value is Oh, the usage is quite flexible, so we will introduce it.
Mysql> delimiter | mysql> Create Fu
MySQL entry (5)-create, modify, and delete tables
A table is the basic unit for storing data in a database. A table contains several fields or records. Table operations include creating, modifying, and deleting tables.
1. Create a table
Create a new table in an existing database. After selecting a specific database using the USE statement, you can USE its SQL s
Tags: default nbsp cal class BER div structure End Font Loop structure while
Create procedurename ()begin
whileconditional do SQL statementsEnd while; End$
Create procedureaa6 ()begin
Declare Number int default 0; while Number 5 DoSelect Number; Set Number = Number + 1; End while; End$Mysql> CREATE PROCEDURE Aa6 ()Begin-Declare number int de
PS: MySQL 5.5 series has become a stable version for some time, but according to my survey, it is still dominated by the 5.1 series in the production environment. In large Chinese companies, it is only determined that Jinshan is using 5.5.
Several of the company's advertising statistics servers, the previous O M directly uses the built-in MySQL 5.0 series. The new programmer writes a new advertisement stat
What should I do if MySQL is taking out the 5-bit UTF code in Chinese?
Use PHP to get the value of MySQL, in the Web page, the Chinese is 5-bit UTF8 encoding, not the text.
Excuse me, what's going on?
MySQL runs show variables like '%char% ';
Character_set_clientutf8
Chara
The following articles mainly describe the easy-to-use commands of MySQL 5, which we usually use in actual operations, if you forget it, it will cause a lot of inconvenience to some actual operations. The following is the detailed description of the article.
1. view all databases: show databases;
2. view all tables in the current database: show tables; or: show t
>Enter the MySQL databaseCommand for Screen Cleaning in the DOS system: clsMysql-h localhost-u root-p-B
-H server (local, specified server IP address) [local localhost can be omitted]-U User Name (we use the root user: Super administrator)-P User Password (password is not required after it is entered, and password is written after press Enter)-B buzzer (the sound prompted when an error is reported when the command is incorrect)3>Commands after enterin
Understanding mysql -- (mysql Learning 1) bitsCN.com
Understanding mysql -- (mysql Learning 1)
Mysql product: cpl protocol and commercial version
Cpl protocol: standalone and cluste
Password 'charset' => 'utf8',],], //...];
For more information about the DSN format, see PHP manual.
In our example, the configuration file is
Db access return ['class' => 'yii \ db \ connection', 'dsn '=> 'mysql: host = localhost; dbname = zhyoulun ', 'username' => 'root', 'Password' => '000000', 'charset' => 'utf8',];
Next, we can write our next test code in views/zhyoulun/HelloWorld. php created in Yii Framework2.0 development tutorial (
Saltstack study 5: the usage of return and return in the database is too much information on the internet. using return to save the result to the database online, there are already:
1. create a database on the master:
CREATE DATABASE `salt`DEFAULT CHARACTER SET utf8DEFAULT COLLATE utf8_general_ci;USE `salt`;---- Table structure for table `jids`--DROP TABLE IF EXISTS `jids`;CREATE TABLE `jids` (`jid` varcha
Question 5: What does MySQL ---------- Consecutive Numbers and numbers mean?
Write a SQL query to find all numbers that appear at least three times consecutively.
+ ---- + ----- + | Id | Num | + ---- + ----- + | 1 | 1 | 2 | 1 | 3 | 1
definition replaces the corresponding part of the statement. The MERGE algorithm requires that the rows in the view and the rows in the base table have a one-to-one relationship. If the relationship does not exist, use a temporary table instead. If the TEMPTABLE option is specified, the view result is placed in a temporary table and then executed using it. ● Select_statement: SELECT statement used to create a view. Multiple tables or views can be queried in a SELECT statement. However, the SELE
(5) mysql-optimized MyISAM Table lock and mysqlmyisam Overview
The MyISAM storage engine only supports table locks. There are two modes for mysql table locks: Read locks and write locks. Their compatibility relationship is (read operations on myisam will not block read requests from other users to the same table, but will block write operations on the same table
MySQL getting started (5) multi-table operations
We are familiar with the basic operations of databases and database tables. now let's take a look at how to operate multiple tables.
Multiple tables may exist in a database, which are associated with each other. We will continue to use the previous example. The preceding table contains basic information about an employee, such as name, gender, date of birth,
1. RENAME DATABASE db_name to New_db_nameThis one.. This syntax was added in MySQL 5.1.7, and 5.1.23 was removed.It is said that data may be lost. It's better not to use it.See: http://dev.mysql.com/doc/refman/5.1/en/rename-database.html2. If all tables are MyISAM type, you can change the name of the folderClose MysqldRename the Db_name directory in the data directory to New_db_nameOpen mysqld3. Rename all
in the future, please You can use MYSQLI or PDO instead. Workaround 1:Prohibit PHP errorDisplay_errors = on change to display_errors = OffSince this server is for users, sometimes they need to make an error (...). Are for friends, ^_^), can not do this, let them change the procedure, see the second program.Workaround 2:Common PHP syntax to connect MySQL is as followsMySQL is commonly used to build table SQ
=51//server number, uniqueLOG-BIN=/MYSQLLOG/SERVER51//Enable Logbin log file, specify its path and file name, must give MySQL account permissionsbinlog-format= "Mixed"//specify log file format with three formats2. How log files Record SQL commandsTime: 180127 23:23:29 Server ID 51Offset: at 3133. Recovering dataA, offset recovery:Mysqlbinlog--start-position=378--stop-position=534/mysqllog/server51.000001 | mysql
Multi-Table operations
We are familiar with the basic operations of databases and database tables. Now let's take a look at how to operate multiple tables.
Multiple tables may exist in a database, which are associated with each other. We will continue to use the previous example. The preceding table contains basic information about an employee, such as name, gender, date of birth, and place of birth. Create another table to describe the articles published by employees, including the author's nam
(5) Common mysql storage enginesOverview
?? Before mysql5.5, the default storage engine is MyISAM, and after 5.5, it is changed to InnoDB. To modify the default engine, you can modify the default-storage-engine in the configuration file. You can use show engines to view the engines supported by the current database. Use select engine from information_schema.engines where transactions = 'yes'; to check which
In MySQL 5, transaction support is started. It must be performed with mysqli in use. There is a certain mode. The following is a summary:
// Instantiate the MySQL class
$ Mysqldb = new mysqli ("localhost", "root", "XXX", "XXX ");
// Start by assuming the transaction operations will all succeed$ Success = true;
// Disable the autocommit feature to set manual t
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.