A Guide to SQL
A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
Question
Book Icon
Chapter 4, Problem 10SCG
Program Plan Intro

“SELECT” command:

The “SELECT” command is used to retrieve data in a database.

Syntax for selecting values from the table is as follows:

SELECT STUDENT_ID FROM STUDENT;

  • The given query is used to display each student ID from “STUDENT” table.

Naming the computed column in SQL:

  • User can assign a name to the computation by using below ways:
    • Name the computation with the word “AS”.
    • User desired name.

Example:

The example for naming the computed column in SQL is shown below:

SELECT STUDENT_ID, STUDENT_NAME, MAXIMUM_LIMIT – SCORE AS STUDENT_CREDIT FROM STUDENT;

The above query is used to display student id, student name and student credit from “STUDENT” table.

STUDENT_IDSTUDENT_NAMESTUDENT_CREDIT
123Merry90
208John86
408Rose98
564Joseph78

Explanation:

  • User can compute the student credit using the expression “MAXIMUM_LIMIT – SCORE”.
  • From the given query, the computation is calculated by using “-” operator that is from “MAXIMUM_LIMIT – SCORE”.
  • Here the computed result is name as “STUDENT_CREDIT” by using the word “AS”.

Blurred answer
Students have asked these similar questions
Based on the ERD below, display the first and last names, hire dates, and number of years employed for all employees who have worked for the organization more than 15 years. Order by the most recent hire date.
Based on the following table, please find the customers who locate in the same state. sales.customers *customer_id first_name last_name phone email street city  state zip_code . Based on the following table, please display the staff and their corresponding manager in the same store. Please display staff’s full name in one column, manager’s full name in another column, and store_id. sales.staffs *staff_id first_name last_name email phone active store_id manager_id
Please help from attached file. Find the distinct number of workers who work in the HR department and who earn more than ₹250,000. Find the last name and title of all workers and the department they work in who earn less than the average salary. What is the average salary paid for all workers in each department? List the department, the average salary for the department, and the number of workers in each department. Name the average column 'AvgSal' and the number of workers column to 'Num'. What is the total compensation for each worker (salary and bonus) on a per monthly basis? List the name of the worker, their title, and the their monthly compensation (annual compensation divided by 12). Change the header for compensation to 'MonthlyComp' and round it to the nearest whole number. List the full names of all workers in all capital letters who did not get a bonus. What are the full names of all workers who have 'Manager' in their title. Do not "hard code" the titles; use string…

Chapter 4 Solutions

A Guide to SQL

Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Text book image
Oracle 12c: SQL
Computer Science
ISBN:9781305251038
Author:Joan Casteel
Publisher:Cengage Learning
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage