1. MySQL database basics, 1. mysql database

Source: Internet
Author: User

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

  

 

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.