Home > Database > Mysql Tutorial > body text

Detailed introduction to simple queries

巴扎黑
Release: 2017-06-11 17:41:32
Original
1940 people have browsed it

Subquery MySQL 4.1 introduced support for subqueries, so to use the SQL described in this chapter, you must use MySQL 4.1 or higher. The SELECT statement is a SQL query. All SELECT statements we have seen so far have been simple queries, i.e., single statements that retrieve data from a single database table. Query Any SQL statement is a query. However, this term generally refers to the SELECT statement. SQL also allows the creation of subqueries, which are queries nested within other queries. Why do we do this? The best way to understand this concept is to examine a few examples. Filtering using subqueries The database tables used in all chapters of this book are relational tables (see Appendix B for a description of each table and relationship). Orders are stored in two tables. The orders table stores one row for each order that contains the order number, customer ID, and order date. Items for each order are stored in the related orderitems table. The orders table does not store customer information. It only stores the customer's ID. The actual customer information is stored in the customers table. Now

1. What is a mysql subquery? How to filter using subqueries?

Detailed introduction to simple queries

Introduction: Subquery MySQL 4.1 introduced support for subqueries, so if you want to use the description in this chapter For SQL, you must use MySQL 4.1 or higher. The SELECT statement is a SQL query. All SELECT statements we have seen so far have been simple queries, i.e., single statements that retrieve data from a single database table. Query Any SQL statement is a query. However, this term generally refers to the SELECT statement.

2. Mysql implements two methods of adding serial numbers to simple query results

Detailed introduction to simple queries

##Introduction: The example in this article describes the simple method of adding serial numbers to query results in MySQL. Share it with everyone for your reference, as follows: The first method: select (@i:=@i+1) as i,table_name.* from table_name,(select @i:=0) as it The second method: set @rownum=0;select @rownum:=@rownum+1 as rownum, t.username from auth_user t limit 1

3. Oracle basic learning simple query and Limited query

Detailed introduction to simple queries

##Introduction: I believe that for everyone who is new to databases, querying is the first step What you need to learn, this article mainly introduces you to simple queries and limited queries in Oracle. The article introduces it to you in detail through sample code and text description. I believe it will be helpful to your understanding and learning. Those who are interested below Come and study together, friends.

4.

swoole uses tasks to make database connection pools, performance

Introduction: I use swoole's tasks I have implemented the connection pool function and made a simple query database function. After using ab stress test, I found that compared with the native connection database, the performance is much worse. I feel that information must be sent to the task process every time, which consumes performance. Yes, I wonder if the stress test results are not ideal...

5.

php connects to the database to implement simple queries

Detailed introduction to simple queries

Introduction:: This article mainly introduces PHP to connect to the database to implement simple queries. Students who are interested in PHP tutorials can refer to it.

6.

php+mysql object-oriented simple query table information

Introduction: php+mysql object-oriented simple query table Query table information

7.

Find an expert to complete the code. A query function. Thank you. It’s only 55 points, all scored

Introduction: Find a master to complete the code. A query function. Thank you. It’s only 55 points, and I want to make a simple query function. The following table can be obtained through query. I need an expert to help me fill in the PHP code. Some of the codes in Curry are as follows: gb2312