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

Cloud computing tutorials for good programmers share Mysql technical knowledge points

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Cloud computing tutorials for good programmers share Mysql technical knowledge. First, let's talk about Mysql sentence refinement.

Install the database, and then import tigerfive.sql. Sql see the end of the document

The MySQL sample database schema consists of the following tables:

-customers: stores the customer's data.

-products: stores data about cars.

-productLines: stores product category data.

-orders: stores sales orders ordered by customers.

-orderDetails: stores order product data items for each sales order.

-payments: stores the payment data information of customer orders.

-employees: stores all employee information and organizational structure, for example, direct superiors (who reports work to whom).

-offices: stores sales office data, similar to each branch

The table relationships are as follows:

Classification of SQL statements: SQL statements are mainly divided into three categories

DDL statement DDL is a data definition statement, which is used to create, delete, modify and other operations on objects within the database. Create, drop, alter, etc. (commonly used in DBA)

DML statement DML is a data operation statement, which refers to the basic operation of database table records, such as insert, update, delete, select, etc. (commonly used in development)

The DCL statement DCL is a data control statement that controls the direct permission and access levels of different data segments. Define the access rights and security levels of databases, tables, fields, users. Mainly grant, revoke, etc. (commonly used in DBA)

Basic operation of database addition, deletion, modification and query of database

Library operation create library

Mysql > create database db1

View the library

Mysql > show databases

Mysql > show create database db1; / / View the library in more detail

Use the library

Mysql > use db1

Paragraph'=''

Table operations create tables

Mysql > create tables table name (field type (modifier))

View tabl

View all tables: mysql > show tables

View table records: mysql > show table status like 'table name'

View the table structure: mysql > desc 'table name'

View table records: mysql > select * from 'table name' limit 10

Modify the table

Modify the table name: mysql > rename table 'source table name' to 'new table name

Field record action field

Add field: mysql > alter table 'table name' add 'field' 'modifier'

Delete field: mysql > alter table 'table name' drop 'field'

Modify fields: mysql > alter table 'table name' change 'old field' new field''modifier'

Record

Add record: insert into 'table name (record, record)' values (), (), ()

: insert into 'table name' values (), (), ()

Modify record: update 'table name' set field =''where field =''

Delete record: delete from 'table name' where 'word

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

Servers

Wechat

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

12
Report