MySQL database Getting Started tutorial

Source: Internet
Author: User
Tags table name



Tenth chapter (3) Upload multiple files and file download processing
Continue: Used in a loop structure to skip the remaining code in this loop and start the next loop.
For more information, see PHP video.


Database
Query statement:
SELECT field name from table name.
Sort order by the name of the field to sort by desc: query in reverse order.
Limit how many to start from: Find a specified number.
Querying multiple fields at the same time is separated by ",".
If all the data in the query form is filled with "*" in the field name.
You can use the left function if you want to display only the first few characters of a field.
SELECT field name, Left (field name, number of digits), field name from table name.
COUNT: Function with total records (ID)
AVG: the average function.
Min: The minimum value function.
Max: A function of the maximum value.
Sum: the function to sum.
WHERE: The result returned is limited.
The LIKE keyword tells MySQL that the specified field matches the given expression, such as the Select Field name from table name WHERE field name like "%" and time >= "2009-01-01" and Time < "2009-02-01";
said: To find the word February record.
Connection database: Mysql-h host< host >-u user< user name >-p Enter password ******< password >
To delete a statement:
Delete from table name WHERE field name like "% to delete"
DELETE from table name < will empty a table >
UPDATE statement:
Update table name SET What to update <date= "2009-01-01" > WHERE field Name <id= "1" > like "% Field content%"
Create a database table: CREATE table creates a name for the tables.
To view the details of a newly created table: DESCRIBE The name of the table you just created.
exporting databases and tables:
Mysqldump-u user name-p database name.
Mysqldump-u user name-P database name table name.
To export other data in the database, see Book 181.
Insert data:
INSERT into table name (field name, field name ...) VALUES ("corresponding field value", "corresponding field value" ...)
Database String Type:
Char: fixed-length type.
VARCHAR: variable length type, length +1.
Database Date Time Type:
Date: Day type.
Time: Date type.
DateTime: Date-time type. <y-m-d h:m:s>
Database Number Type:
Tinyint:1 byte 255
Smallint:2 byte 65535
Mediumint:3 byte 16777215
Int:4 byte 4294967295
Bigint:8 byte 18446744073709551615
Session_unregister (the variable name to be removed, such as $_session["..."]) can delete a session variable, where the unset () function is equivalent to this function.
Session_destroy (none) ends the current session, this function has no arguments, and the return value is true.
Session_Start (None) Initializes a session or continues the current session.
Session_decode (the data to decode) decrypts a current session content that is encrypted using Session_encode ().
Require (), require_once (), include (), include_once () a function that calls an external file.
Header ("Location: Address to go to") jumps the connection.
Mysql_fetch_array () takes one row from the result set as an associative array, or an array of numbers, or both.
Mysql_fetch_row () gets one row from the result set as an enumerated array.
Mysql_fetch_lengths () Gets the length of each output in the result set, the execution failure returns false, and the first subscript of the returned array is 0.
Mysql_data_seek () can move the internal return pointer, successfully returns TRUE, and the failure returns false.
Mysql_field_name () Gets the field name of the specified field in the result.
Mysql_field_table () Gets the name of the datasheet that contains the specified field.
Mysql_field_len () returns the length of the specified field.
Mysql_num_fields () Gets the number of returned fields.
Mysql_num_rows () Gets the number of rows returned.
Mysql_list_tables () lists the data tables for the specified database.
Mysql_tablename () Gets the data table name.
Mysql_affected_rows () Gets the number of record rows that were affected by the previous MySQL operation.
Mysql_errno () returns the error message code.
Mysql_error () returns an error message.
MYSQL_INSERT_ID () Gets the ID generated by the previous insert operation.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.