It suddenly dawned on me today that 1 of the Int (1) and tinyint (1) in MySQL only specify the display length, not the storage length, only useful if the field specifies Zerofill. The limit of the digits is basically meaningless.Int (5) Here
Tags: mysql learn note mysql primerCharacter set and proofing rules1. Character set: A set of symbols and character encodings.2. Proofing Rules: A set of rules that are used to compare characters within a character set. 3, the installation of the database is best with our fixed code.4. You can specify a character set when you create a table: ..... Charset=[gdk/utf8] ;5
Mysql> select something from tbl_name
Where to_days (now ()-to_days (date_col)
Dayofweek (date)Returns the week index of date (1 = Sunday, 2 = Monday,... 7 = Saturday ). The index value complies with ODBC standards.Mysql> select dayofweek ('2017-02-03 ');-> 3
Weekday (date)Returns the week index of date (0 = Monday, 1
server_id One is 36, the other one is 37, here must be inconsistent:3: Execute the following command to establish a master-slave relationship, 192.168.10.37 for 192.168.10.36 slaveExecute on 192.168.10.36:Grant Replication Slave on * * to ' sync ' @ ' 192.168.10.37 ' identified by ' sync ';Execute on 192.168.10.37:Change Master to master_host= ' 192.168.10.36 ', master_user= ' repluser ', master_password= ' Replpass ', master_auto_ Position=1; (used
Tags: LTE sam combo using glob mysql tween SQL balance1. Storage Engine Differences between INNODB and MYIASM storage engines:1.innodb is the default storage engine after the mysql5.5 version, and MyISAM is the default storage engine of the previous 5.5 version.2.innodb supports things, and MyISAM doesn't support thingsThe 3.INNODB supports row-level locks. and myiasm it supports concurrent table-level lock
Connect C ++/C to the MySQL database in Linux (1)
I. Preparations before connection
Raw Material: Ubuntu12.04LTS
(MySQL5.5 or a later version has been installed. The new software package, gcc/g ++ or CodeBlosks compiler)
After the above software packages are installed, we can use MySQL to complete data management, but many times we need to write a program to acce
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 name, article title, and
order by cannot use the index sort.
Iii. Index and lock
Indexes allow fewer rows to be locked by the query, because the index allows the query not to access those unwanted rows, and then locks fewer rows. This has 2 advantages:
1. Reduce the extra overhead of locking lines.
2, lock more than needed to increase lock contention and reduce concurrency.
InnoDB locks the row only when it is accessed, and the index reduces the number of rows accessed
MySQL getting started (1) installation
PHP + MySQL + Linux has gradually become a classic combination of small web servers. Building and debugging MySQL databases in the indows environment is a preferred choice for many website developers. I am a beginner in MySQL in Window
delete (reference alias T1), and then on the connection in the table-with a subquery get, (reference alias T2), the condition of the connection is the same name, but the same is not all deleted, but rather delete the larger record ID number (the ID number in the table above is the same name under the small ID).
delete t1 from tdb_goods as t1 left join(select goods_id,goods_name from tdb_goods group by goods_name having count(goods_id) >=2) as t2 on t1.goods_name=t2.goods_name where t1.goo
Mysql Study Notes 5 ----- field data type
I. numeric type
Integer:
Tinyint 1 byte
Smallint 2 bytes
Mediumint 3 bytes
Int/intege 4 bytes
Bigint 8 bytes
You can use unsigned to control whether there are positive and negative values.
Zerofill can be used for leading zero-padding.
The bool type exists, which is actually the alias of tinyint (
='dtntr'
) 2. Using a self-junction SELECT p1.prod_id, P1.prod_name
from as as P2
WHERE = p2.vend_id
and = ' dtntr ' 7--external coupling In the example above, the junction contains rows that have no associated rows in the related table, and this type of join is called an outer junction. Retrieving all customers and their orders 1. Use inner coupling SELECT cust_name, Order_num
from as INNER JOIN as o
Usage of MySQL time Conversion Function
Dayofweek (date)Returns the index of the week of the date (1 = Sunday, 2 = Monday ,...... 7 = Saturday ). These index values correspond to the ODBC standard.Mysql> select dayofweek (2007-10-31 );-> 4
Weekday (date)Returns the week index of date (0 = Monday, 1 = Tuesday ,.....
space.NOTE: varchar will add one to two extra bytes to store the true length of the data, so the storage: ABCD, the space will occupy: 4+1, where the 1 is used to store the true length of the data.If the length of the data is longer than 255 characters, then the space that stores the true length becomes 2.A varchar type can store 65,535 characters.How should char and varchar be chosen?Char Type: Faster cal
Method 1,Analyze table:This statement is used to analyze and store the keyword distribution of a table. During parsing, the table is locked with a read lock. This is useful for MyISAM, BDB, and InnoDB tables.Method 2,CHECK TABLE:Check if one or more tables have errors. CHECK table is useful for MyISAM and InnoDB tables. For the MyISAM table, the keyword statistics are updated.Check table also checks whether the view has errors, such as the table refer
Mysql study 5: SQL statement study 3 well, we think this font is quite nice, and we will change it all.
The insert into statement is used to INSERT new rows INTO the table.
Syntax
Insert into table name VALUES (value 1, value 2 ,....)
You can also specify the columns to insert data:
Insert into table_name (Column 1
hole.Lock SchedulingMyISAM read lock and write lock are mutually exclusive, read and write serial. Then, when a process requests a lock on a MyISAM table, the other process also requests a write lock on the same table. How does MySQL handle it? The result is a write-ahead read process. This is supposed to be important for MySQL to consider writing requests generally more than read requests. There are some
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.