Capabilities of the SELECT Statement(SELECT语句的功能)
Data retrieval from data base is done through appropriate and efficient use of SQL. Three concepts from relational theory encompass the capability of the SELECT statement: projection, selection, and joining.
- Projection(投影): A project operation selects only certain columns (fields) from a table. The result table has a subset of the available columns and can include anything from a single column to all available columns. (选择列的能力)
- Selection(选择): A select operation selects a subset of rows (records) in a table (relation) that satisfy a selection condition. The ability to select rows from out of complete result set is called Selection. It involves conditional filtering and data staging. The subset can range from no rows, if none of the rows satisfy the selection condition, to all rows in a table. (从表里选择所需要的行)
- Joinin连接): A join operation combines data from two or more tables based on one or more common column values. A join operation enables an information system user to process the relationships that exist between tables. The join operation is very powerful because it allows system users to investigate relationships among data elements that might not be anticipated at the time that a database is designed. (连接多个表)
Consider the above table structures. Fetching first_name name, department_id and salary for a single employee from EMPLOYEES table is Projection. Fetching employee details whose salary is less than 5000, from EMPLOYEES table is Selection. Fetching employee‘s first name, department name by joining EMPLOYEES and DEPARTMENTS is Joining.
Question: Identify the capabilities of SELECT statement.
- Projection
- Selection
- Data Control
- Transaction
Answer: A, B. The SELECT statement can be used for selection, projection and joining.
时间: 2024-08-04 23:13:55