Home Database Mysql Tutorial 基础SQL语句

基础SQL语句

Jun 07, 2016 pm 05:40 PM
Base statement

增:insert into T_1(Name,Age) values (李小争23); Values 中顺序要和表名中的顺序一致 查:select Name,Id from T1; Select * from T1;//查询出所有字段 select * from T_Student where Age30 删:delete from T_Student where 从T_Student中删除Name

增:insert into  T_1(Name,Age) values (’李小争’23);

Values 中顺序要和表名中的顺序一致

 

查:select Name,Id from T1;

Select * from T1;//查询出所有字段

select * from T_Student where Age

 

删:delete from T_Student where

从T_Student中删除Name字段等于lxz的数据

Delete from T_Student

删除T_Student中的所有数据

 

Delete from T_Student where Age>100 or Name=’lxz’   或者

Delete from T_Student where Age>100 and Height>150   并且

 

 

更新:update T_Student set Age=Age+1

 

update T_Student set Height=180

 

update T_Student set Love='散步' where Age>100

 

select Name as 姓名, Age as 年龄 from T_Student

select MAX(age) from T_Student  查询最大年龄

select MAX(age),MIN(age) from T_Student

 

select MAX(age) as 最大年龄,MIN(age) as 最小年龄,AVG(age) as 平均年龄 from T_Student

select MAX(age) as 最大年龄,MIN(age) as 最小年龄,AVG(age) as 平均年龄,COUNT(*) as 总行数  from T_Student

 

select * from T_Student where Name like 'y%'

查询以y开头后面有若干个字符。。。

 

select * from T_Student where Name like '%a%'

查询含有a

 

 

select * from T_Student order by Age    按照年龄升序排列

select * from T_Student order by Age Desc  按照年龄升序排列

 

select * from T_Student where Name like 'y%' order by Age 

 

,免备案空间,香港虚拟主机,香港服务器租用
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP Basics Tutorial: From Beginner to Master PHP Basics Tutorial: From Beginner to Master Jun 18, 2023 am 09:43 AM

PHP is a widely used open source server-side scripting language that can handle all tasks in web development. PHP is widely used in web development, especially for its excellent performance in dynamic data processing, so it is loved and used by many developers. In this article, we will explain the basics of PHP step by step to help beginners from getting started to becoming proficient. 1. Basic syntax PHP is an interpreted language whose code is similar to HTML, CSS and JavaScript. Every PHP statement ends with a semicolon; Note

multi-catch statement in PHP8.0 multi-catch statement in PHP8.0 May 14, 2023 pm 01:51 PM

With the development of web applications, PHP language has been widely used in web development. In the PHP8.0 version, a new language feature was introduced - the multi-catch statement. What is a multi-catch statement? In previous PHP versions, developers needed to write multiple catch statements to handle multiple exception types. For example, the following code block shows the handling of two different exceptions: try{//Somecodethatmay

Learn the basics of Go language variables Learn the basics of Go language variables Mar 22, 2024 pm 09:39 PM

Go language is a statically typed, compiled language developed by Google. Its concise and efficient features have attracted widespread attention and love from developers. In the process of learning the Go language, mastering the basic knowledge of variables is a crucial step. This article will explain basic knowledge such as the definition, assignment, and type inference of variables in the Go language through specific code examples to help readers better understand and master these knowledge points. In the Go language, you can use the keyword var to define a variable, which is the format of the var variable name variable type.

To understand flow control statements in Python, you need to master several situations To understand flow control statements in Python, you need to master several situations Jan 20, 2024 am 08:06 AM

Python is a widely used high-level programming language. It is easy to learn, efficient and flexible, and is deeply loved by developers. In Python, flow control statements are an important part of implementing program logic. This article will introduce commonly used flow control statements in Python and provide code examples to deepen understanding. In Python, common flow control statements include conditional statements and loop statements. Conditional statements execute different code blocks based on the true or false condition and are used to determine and select execution branches. The loop statement is used to repeat

How to implement the statement of inserting data in MySQL? How to implement the statement of inserting data in MySQL? Nov 08, 2023 am 11:48 AM

How to implement the statement of inserting data in MySQL? When using a MySQL database, inserting data is a very basic and common operation. By inserting data, new records can be added to database tables to provide support for business operations. This article will introduce how to use the INSERT statement in MySQL to implement data insertion operations, and provide specific code examples. The INSERT statement in MySQL is used to insert new records into the database table. Its basic syntax format is as follows: INSERTINTOt

How to implement the statement to unlock the table in MySQL? How to implement the statement to unlock the table in MySQL? Nov 08, 2023 pm 06:28 PM

How to implement the statement to unlock the table in MySQL? In MySQL, table locks are a commonly used locking mechanism used to protect data integrity and consistency. When a transaction is reading and writing to a table, other transactions cannot modify the table. This locking mechanism ensures data consistency to a certain extent, but may also cause other transactions to be blocked. Therefore, if a transaction cannot continue for some reason, we need to manually unlock the table so that other transactions can continue. MySQL provides a variety of

Introduction to PHP Basics: How to use the echo function to output text content Introduction to PHP Basics: How to use the echo function to output text content Jul 30, 2023 pm 05:38 PM

Basic introduction to PHP: How to use the echo function to output text content. In PHP programming, you often need to output some text content to a web page. In this case, you can use the echo function. This article will introduce how to use the echo function to output text content and provide some sample code. Before starting, first make sure you have installed PHP and configured the running environment. If PHP is not installed yet, you can download the latest stable version from the PHP official website (https://www.php.net).

Can I learn Linux from scratch? What do I need to learn? Can I learn Linux from scratch? What do I need to learn? Feb 19, 2024 pm 12:57 PM

If you want to work in the IT industry, but do you want to learn programming, which technology should you choose? Of course it is Linux operation and maintenance. Linux is a very popular technology on the market, with a wide range of applications and good employment prospects, and is liked by many people. So the question is, can I learn Linux operation and maintenance with zero basic knowledge? In the server market, Linux system has a market share of up to 80% because of its advantages such as stability, security, free open source, efficiency and convenience. From this, it can be seen that Linux applications are very popular. Extensive. Whether now or in the future, learning Linux is a very good choice. As for whether it is possible to learn from scratch? My answer is of course. Oldboy Education Linux face-to-face class is specially designed for people with zero basic knowledge

See all articles