1. MySQL database basics, 1. mysql database
1. MySQL database Basics
Display the current server version select version ();
Display the current date and time select now ();
Displays the select user () of the current USER ();
View database show databases;
View the warning show warnings;
2. MySQL statement specifications
(1) All keywords and function names are in uppercase;
(2) The database name, table name, and field name are all in lowercase;
(3) The SQL statement must end with a semicolon.
3. Create a database
CREATE {DATABASE | SCHEMA} [if not exist] db_name [DEFAULT] character set [=] charset_name; here "{}" indicates a required parameter, "|" indicates the selection from these items, "[]" indicates the option, and generally indicates the judgment item. Create database | SCHEMA db_name is required, and other items may exist. The character set clause is used to specify the default database character set. For example:
Create database user1;
4. Modify the database
ALTER {DATABASE | SCHEMA} [db_name] [default] character set [=] charset_name;
5. delete a database
DROP {DATABASE | SCHEMA} [if exists] db_name;
Summary:
MySQL Default port: 3306
MySQL Super User: root
CREATE DATABASE
Modify DATABASE: ALTER DATABASE
Delete database: DELETE DATABASE
6. Data Type
Data type refers to the data features of columns, stored procedure parameters, expressions, and local variables. It determines the data storage format and represents different information types. One of the principles of Data Optimization: select the best and most appropriate data type, rather than the largest data type.
(1) INTEGER (age, etc)
(2) floating point
(3) Date and Time
(4) balanced