SQL--MYSQL query statement Daquan, sqlmysql statement

Source: Internet
Author: User

SQL--MYSQL query statement Daquan, sqlmysql statement

1: Use the SHOW statement to find out the current database on the server:

Mysql> show databases;

2. Create a database named MYSQLDATA

Mysql> create database mysqldata;

3: select the database you created

Mysql> use mysqldata; (when you press the Enter key to see Database changed, the operation is successful !)

4: view the tables in the current database

Mysql> show tables;

5. Create a database table

Mysql> create table mytable (name VARCHAR (20), sexCHAR (1 ));

6: display the table structure:

Mysql> describe mytable;

7. Add records to the table

Mysql> insert into MYTABLE values ("hyq", "M ");

8: load data into database tables in text mode (for example, D:/mysql.txt)

Mysql> load data local infile "D:/mysql.txt" into Table MYTABLE;

9: import the. SQL FILE command (for example, D:/mysql. SQL)

Mysql> use database;

Mysql> source d:/mysql. SQL;

10: delete a table

Mysql> drop table mytable;

11: Clear the table

Mysql> delete from MYTABLE;

12: Update table data

Mysql> update MYTABLE set sex = "f" where name = 'hyq ';

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.