Basic operations of the front-end database and the front-end database

Source: Internet
Author: User

Basic operations of the front-end database and the front-end database
* Directory [1] logon and exit [2] statement specification [3] Common commands [4] Before database operations

SQL is an ANSI standard computer language used to access and process databases. However, there are many different versions of SQL languages. To be compatible with ANSI (American National Standards Institute) standards, they must support some major keywords (such as SELECT, UPDATE, DELETE, INSERT, and WHERE) in a similar way)

RDBMS refers to a relational database management system. RDBMS is the foundation of SQL and also the basis of all modern database systems, such as Oracle, MySQL, and Access. Data in RDBMS is stored in database objects called tables. A table is a collection of related data items. It consists of columns and rows.

The following describes basic mysql database operations.

 

Log on and exit

The first step in database operations is to log on to the database. A MySQL user name and password are usually required. If the server runs on a machine other than the login server, you must specify the Host Name

Parameter description-D (database) Open the specified database-h (host) server name-p (password) password-P (port) port number-u (user) user Name-V (version) output version information and exit

Mysql database exits in three ways: exit;, quit;, and \ q ;. Select either of them.

Statement Specification

Before operating the database, you must first understand the database statement specifications, which mainly include the following three

1. All keywords and function names are capitalized

2. The database name, table name, and field name are all in lowercase.

3. the SQL statement must end with a semicolon

 

Common commands

The mysql database has the following common commands:

Select version (); displays the current server version select now (); displays the current date and time select user (); displays the current USER
Database Operations

The first step in database operations is to create a database.

CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [DEFAULT] CHARACTER SET [=] charset_name

Creating a database does not mean selecting and using it. You must perform operations explicitly. Therefore, the second step of database operations is to select a database.

USE db_name

Next, let's view the Database List under the server

SHOW {DATABASES | SCHEMAS} [LIKE 'pattern' | WHERE expr] 

Sometimes, we need to modify the database

ALTER {DATABASE | SCHEMA} [db_name] [DEFAULT] CHARACTER SET [=] charset_name

Finally, delete the database.

DROP {DATABASE | SCHEMA} [IF EXISTS] db_name

View the Database List under the server

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.