Home > Database > SQL > What does from mean in sql

What does from mean in sql

下次还敢
Release: 2024-04-28 12:15:22
Original
877 people have browsed it

FROM keyword is used to specify the data source (i.e. table) to be queried. Its syntax is: FROM table_name, specify the table to be queried in the SELECT statement; specify the table to be connected in the JOIN operation; in Specify the subtable to be queried in the subquery.

What does from mean in sql

FROM keyword in SQL

The role of FROM keyword

FROM keyword is used to specify the data source to be queried, that is, which table to extract data from.

FROM keyword syntax

<code>FROM table_name</code>
Copy after login

Among them, table_name is the name of the table to be queried.

Usage of FROM keyword

The FROM keyword is usually used in the SELECT statement to specify the table to be queried. For example:

<code>SELECT * FROM customers;</code>
Copy after login

This query will select all rows and columns from the table named customers.

FROM keyword in JOIN operation

The FROM keyword can also be used in JOIN operation to specify the table to be connected. For example:

<code>SELECT * FROM customers
INNER JOIN orders ON customers.id = orders.customer_id;</code>
Copy after login

This query will join the customers table and the orders table and will id from the customers table Column matches the customer_id column in the orders table.

FROM keyword in subquery

FROM keyword can also be used in subquery to specify the subtable to be queried. For example:

<code>SELECT * FROM (
    SELECT * FROM customers
    WHERE city = 'New York'
);</code>
Copy after login

This query will select all rows from the customers table where the city column is equal to New York.

The above is the detailed content of What does from mean in sql. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template