MySQL get started with a recruit

Source: Internet
Author: User

Connect MySQL database command: mysql-u root-p

Creating MySQL Database: Create databaase XX library;

To create a MySQL table:

CREATE TABLE Db_xx Tables (

ID int primary KEY auto_increment,

Name varchar (+) is not NULL,

Address varchar (+) is not NULL,

Salary Decimal (9,2),

Createtime

----Building a table operation

CREATE TABLE Db_job (
ID int primary KEY auto_increment,
Createtime datetime DEFAULT Current_timestamp,
UpdateTime datetime default NULL,

Startime timestamp not NULL default current_timestamp,

Endtime datetime default NULL

State Int (10)
);

----View Table structure

desc XX table name;

----View version number

Added insert into XX table (field 1, Field 2 ...). VALUES (' value 1 ', ' Value 2 ',....)

Modify Update db_job set state= ' 999 ' where id=1;

Delete the delete from db_job where state=999;

Query select * from Db_job where state=398;

Add a field: ALTER TABLE db_job ADD column name varchar (16)

Modify a field name: ALTER TABLE db_job change old field name new field name varchar (32); New field type

Modify a field value: Update T8 set name= "Demo" where id=1;

Delete a field: ALTER TABLE db_job drop name;

Modify table name: Rename table cousin name to new name;

Modify Library Name: RENAME database db_name to New_db_name

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- ------------------------------

  

MySQL get started with a recruit

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.