Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql basic Syntax 1

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Software Architecture of MySQL

1. Enable MySQL server: open it as a windows service, net startmysql under cmd | net stop mysql, and use mysqld-default-file= "d:/amp/mysql/my.ini" under cmd.

two。 Connect to the MySQL server

The 3.mysql help command, help, and the instructions can be completed using the\ letter.

4.mysql comment character: line comment: # or--, block comment is / * /

Operation of database

Create database: create database library name [library options]

View database: show databases; show createdatabase library name

Delete database: drop database [if exists] library name

Modify database: only library options can be modified; alter database library name new library option

Data table operation

Select database: explicit selection, with the library name before the table name; implicit selection, use library name

Create a data table: create table table name (field list) [table options]

View data table: show tables; show createtable table name; describe | desc table name

Modify the data table:

1 modify table name: altertable table name rename to new table name; rename table old table name to new table name

2 modify the column definition:

Add a column: alter table table name add new field name field type

Delete a column: alter table table name drop field name

Modify field type: alter table table name modify field name new field type

Modify field sort: alter table table name modify field name 1 New field type

First | after field name 2

Rename field: alter table table name change old field name new field name new field type

3 modify table option: altertable table name new table option (default charset gbk engine Myisam)

Data operation

Insert data: insert into table name (field list) values (values list)

View data: select * | Field list from table name [where query criteria]

Delete data: delete from table name [where deletion condition]

Modify data: update table name set field 1 = new value 1, field 2 = new value 2. [where modification conditions]

Numerical type

1. Integer: tinyint,smallint, mediumint,int,bigint

two。 Decimal:

a. Floating point number float/double

b. Fixed point: decimal, also known as currency type

Date and time type

Datetime and timestamp

Date

Time: time interval | time of day

Representatives after year:70, 19XX, 69 and before 69, 20XX.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report