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

What are the basic knowledge points of Mysql

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces what are the basic knowledge points of Mysql, which are introduced in great detail and have certain reference value. Friends who are interested must finish reading them.

What are the characteristics of the database?

The data is structured, there is a connection between the data, facing the whole system; the sharing of the data is high, the redundancy is low, and it is easy to expand; the data is independent.

What databases are there?

MySQL, SQL Server, Oracle, Hadoop, etc.

The types of databases include?

There are three popular database models in the early days, which are

Hierarchical database

Network database

Relational database

In today's Internet, the most commonly used database models are mainly two, namely

Relational database

Non-relational database.

What are DDL, DQL, DML?

DDL (Data Definition Language) data definition language

Used to define database objects: databases, tables, columns, etc. Keywords: create,drop,alter, etc.

DQL (Data Query Language) data query language

Used to query the records (data) of tables in the database. Keywords: select, etc.

DML (Data Manipulation Language) data manipulation language

Used to add, delete and modify the data of the tables in the database. Keywords: insert,delete,update, etc.

What are the constraints? What does it mean that they are apart?

Primary key constraint: primary key

Non-empty constraints: not null

Unique constraint: unique

Foreign key constraints: foreign key

What is the composition of the database system?

Database

Computer hardware

Computer software

Database user

What are the functions? The name function AVG () returns the average value of a field COUNT () returns the number of rows in a field MAX () returns the maximum value of a field MIN () returns the minimum value of a field SUM () returns the sum of paging queries for the field?

If only one parameter is given, it represents the number of records.

Two parameters, the first parameter represents offset, and the second parameter is the number of records.

Limit mrem n; filter duplicate data? SELECT DISTINCT FROM; fuzzy query? [NOT] LIKE 'string

NOT: optional parameter that satisfies the condition when the content of the field does not match the specified string.

String: specifies the string to be used to match. "string" can be a complete string or contain wildcards.

The LIKE keyword supports percent sign "%" and underscore "_" wildcards.

The difference between varchar and char?

The length of char is immutable, while the length of varchar is variable, that is to say, define a char [10] and varchar [10]. If what is stored is' csdn', then the length of char is still 10, in addition to the character 'csdn', followed by six spaces, and varchar immediately changes the length to 4. When taking data, the char type should use trim () to remove the extra spaces, while varchar is not needed.

In addition, the storage mode of char is to occupy 1 byte for English characters (ASCII) and two bytes for a Chinese character, while the storage mode of varchar is to occupy 2 bytes for each English character and 2 bytes for Chinese characters.

New view, delete view statement?

Create a new view:

Create view View name as select statement

Delete the view:

Drop view View name

Focus on: notes of database .md, data definition language (DDL) .md

The last big question is 30 points.

Test sites: building database, building tables, querying

Reference: all homework activities

Example:

-- create create table stuInfo (stuId int primary key auto_increment, stuName varchar (10) not null, stuAge int not null, stuSex int not null check (stuSex = 0 or stuSex = 1), time datetime) create table courseInf (courseId int primary key auto_increment, courseName varchar (10) not null, courseMarks int not null) create table scoreInfo (scoreId int primary key auto_increment, stuId int CourseId int, score int not null, constraint scoreInfo_stuInfo_fk foreign key (stuId) references stuInfo (stuId), constraint scoreInfo_courseInf_fk foreign key (courseId) references courseInf (courseId))-insert insert into stuInfo () values (default,'Tom',19,1,null), (default,'Jack',20,0,null), (default,'Rose',21,1,null), (default,'Lili',21,0,null), (default) 'adc',20,1,'2007-01-07 01 / 01 / 11 / 11 / 01 / 07 / 01 / 11) Insert into courseInf () values (default,'JavaBase',4), (default,'HTML',2), (default,'JavaScript',2), (default,'SqlBase',2) Insert into scoreInfo () values (default,1,1,80), (default,1,2,85), (default,1,4,50), (default,2,1,75), (default,2,3,45), (default,2,4,75), (default,3,1,45), (default,4,1,95), (default,4,2,75), (default,4,3,90), (default,4,4,45) -- find out the number of courses taken by each student and the average score of the examination for the course taken select count (courseId), avg (score) from scoreInfogroup by stuId;-- modify UPDATE table_name SET field1=new-value1, field2=new-value2 [WHERE Clause]-- Delete DELETE FROM table_name [WHERE Clause]

Reminder: if you carefully read the students who have finished their homework, they will definitely get a full mark on the last big question. Dddd, you will stop talking about it.

The above is all the contents of the article "what are the basic knowledge points of Mysql". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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: 260

*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