Sql--mysql Query Statement Daquan

Source: Internet
Author: User

1: using show statement to find out what database currently exists on the server:

Mysql> SHOW DATABASES;

2:2 , create a database Mysqldata

mysql> CREATE DATABASE Mysqldata;

3: Select the database that you created

mysql> use Mysqldata; ( Press ENTER to appear database changed the operation is successful!) )

4: See what tables exist in the current database

Mysql> SHOW TABLES;

5: To Create a database table

Mysql> CREATE TABLE MYTABLE (name VARCHAR), Sexchar (1));

6: show the structure of the table:

Mysql> DESCRIBE MYTABLE;

7: add a record to the table

mysql> INSERT INTO MYTABLE values ("HyQ", "M");

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

mysql> LOAD DATA LOCAL INFILE "D:/mysql.txt" intotable MYTABLE;

9: Import. SQL file commands (e.g. D:/mysql.sql)

Mysql>use database;

Mysql>source D:/mysql.sql;

Ten: Delete a table

Mysql>drop TABLE MYTABLE;

One : Clear Table

Mysql>delete from MYTABLE;

: updating data in a table

Mysql>update MYTABLE set sex= "F" where name= ' HyQ ';

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Sql--mysql Query Statement Daquan

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.