bitsCN.com
一、术语
1、数据库(database)
2、数据库管理系统(DBMS)
3、列(column)/行(row)
4、主键(Primary key)
5、SQL(Structured Query Language)结构化查询语言
特点:(1)、所有DBMS都支持
(2)、简单易学、灵活强大
二、常用命令之一
6、MySQL选项和参数:
1: 指定用户登录名Ben:
2: mysql -u ben
3: 给出用户名、主机、端口、和口令:
4: mysql -u ben -p -h myserver -p 9999
(1)、命令输入在mysql>之后;输入help或/h获得帮助
(2)、命令用;或/g结束;输入quit、exit退出命令行
7、子句(clause):
clause有子句、条款的意思,SQL语句由子句构成,分可选和必需;一个子句通常由一个关键字和所提供的数据组成。如SELECT 语句的FROM子句,或ORDER BY子句
8、通配符(*)尽量不要使用,因为在检索不需要的列会降低检索或程序性能。
9、DISTINCT关键字指示Mysql只返回不同的值:
1: SELECT DISTINCT title FROM new
10、LIMIT子句限制返回的结果
1: SELECT id,title FROM new LIMIT 3
LIMIT m,n: 其中m表示从m行开始,n表示要检索的行数
当行数不够时,检索最大行的。
注意:Mysql5支持另一种LIMIT替代语法,LIMIT n OFFSET m:从m行开始曲n行
1: SELECT id,title FROM new LIMIT 1 OFFSET 3
2: SELECT id,title FROM new LIMIT 3,1
3: 效果一样
11、使用完全限定的表名
1: SELECT new.id,new.title FROM new
2: 当然表也可使用完全限定如:Mydata.new
12、ORDER BY子句
ORDER BY子句取出一个或多个列的名字,据此对输出进行排序 默认是升序(ASC),还可以降序(DESC),注意DESC只应用到直接位于其前面的列名。
如果在多个列中进行降序排列,必须在每个列指定DESC关键字
13、使用SHOW语句找出在服务器上当前存在什么数据库
1: SHOW DATABASES;
后面是复数
14、创建一个数据库MYSQLDATA
1: CREATE DATABASE MYSQLDATA;15、创建一个数据库表
1: CREATE TABLE product (pro_id INT,pro_price FLOAT,pro_name VARCHAR(20));
17、显示表的结构
1: DESCRIBE product
describe:描述、形容
在navicat for Mysql中显示如下:
18、往表中加入记录
1: INSERT INTO product VALUES(15.00,'pen')
2: #插入多行
3: INSERT INTO product (pro_price,pro_name) VALUES(12.00,' toothpaste'),
4: (18.00,'belt'),(15.00,'basin'),(52.30,'pot')
19、在navcat for mysql中对建立id
20、在navcat for mysql中设置字符集
选择‘product’表---右键 ‘设计表’---
同时可以设置主键
如此一来,我们就可以在表中插入中文数据;:
1: INSERT INTO product (pro_price,pro_name) VALUES(1.00,'SoftDrink'),(2.00,'矿泉水')
21、删除表
1: mysql>drop TABLE MYTABLE;
22、清空表
1: DELETE FROM new
23、更新数据
1: UPDATE product SET pro_price=50.00 WHERE pro_name='pot'24、使用ORDER BY 和 LIMIT的组合,能找出一个列中最高或最低的值:
1: SELECT pro_price,pro_name FROM product ORDER BY pro_price DESC LIMIT 1
注意顺序
bitsCN.com
InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment