A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 4, Problem 5RQ
Explanation of Solution
Computed column in SQL:
- User can perform computations using SQL queries.
- A computed column does not occurs in the
database however it can be computed by using data present in the existing columns. - The computations can involve any arithmetic operator.
- Computations can computed by using the arithmetic operator such + (addition), - (subtraction), * (multiplication) and / (division).
- Then write the computation result into a place of a particular column name.
Example:
The example for using computed column in SQL is given below:
SELECT STUDENT_ID, STUDENT_NAME, MAXIMUM_LIMIT – SCORE FROM STUDENT;
The above query is used to display student id, student name and student credit from “STUDENT” table...
Explanation of Solution
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...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
True or FalseString comparisons in SQL are case sensitive.
I was wondering if you could do this in PL/SQL format.
declare
begin
end; etc
How does the PARSE function differ from the TRY_PARSE function in SQL when converting data types?
Chapter 4 Solutions
A Guide to SQL
Ch. 4 - Prob. 1RQCh. 4 - Prob. 2RQCh. 4 - Prob. 3RQCh. 4 - Prob. 4RQCh. 4 - Prob. 5RQCh. 4 - In which clause would you use a wildcard in a...Ch. 4 - Prob. 7RQCh. 4 - How do you determine whether a column contains one...Ch. 4 - Prob. 9RQCh. 4 - Prob. 10RQ
Ch. 4 - Prob. 11RQCh. 4 - Prob. 12RQCh. 4 - Prob. 13RQCh. 4 - Prob. 14RQCh. 4 - Prob. 15RQCh. 4 - Prob. 16RQCh. 4 - How do you find rows in which a particular column...Ch. 4 - Use the Internet to research the SQL [charlist]...Ch. 4 - Prob. 1TDCh. 4 - Prob. 2TDCh. 4 - Prob. 3TDCh. 4 - Prob. 4TDCh. 4 - Prob. 5TDCh. 4 - Prob. 6TDCh. 4 - Prob. 7TDCh. 4 - Prob. 8TDCh. 4 - Prob. 9TDCh. 4 - Prob. 10TDCh. 4 - Prob. 11TDCh. 4 - Prob. 12TDCh. 4 - Prob. 13TDCh. 4 - Prob. 14TDCh. 4 - Prob. 15TDCh. 4 - Prob. 16TDCh. 4 - What is the price of the least expensive item in...Ch. 4 - Prob. 18TDCh. 4 - Prob. 19TDCh. 4 - Prob. 20TDCh. 4 - Prob. 21TDCh. 4 - Prob. 22TDCh. 4 - Prob. 23TDCh. 4 - Prob. 1CATCh. 4 - Prob. 2CATCh. 4 - Prob. 3CATCh. 4 - Prob. 4CATCh. 4 - Prob. 5CATCh. 4 - Prob. 6CATCh. 4 - Prob. 7CATCh. 4 - Prob. 8CATCh. 4 - Prob. 9CATCh. 4 - Prob. 10CATCh. 4 - Prob. 11CATCh. 4 - Prob. 12CATCh. 4 - Prob. 13CATCh. 4 - Prob. 14CATCh. 4 - Prob. 15CATCh. 4 - Prob. 16CATCh. 4 - Prob. 17CATCh. 4 - Prob. 18CATCh. 4 - Prob. 19CATCh. 4 - List the reservation ID and trip ID for all trips...Ch. 4 - Prob. 1SCGCh. 4 - Prob. 2SCGCh. 4 - Prob. 3SCGCh. 4 - Prob. 4SCGCh. 4 - Prob. 5SCGCh. 4 - Prob. 6SCGCh. 4 - Prob. 7SCGCh. 4 - Prob. 8SCGCh. 4 - Prob. 9SCGCh. 4 - Prob. 10SCGCh. 4 - Prob. 11SCGCh. 4 - Prob. 12SCGCh. 4 - Prob. 13SCGCh. 4 - Prob. 14SCGCh. 4 - Prob. 15SCGCh. 4 - Prob. 16SCG
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- how do you use PL/SQL or T-SQL procedures in SQL?arrow_forwardImagine a student table with following columns: Student(Stuid, Name , Age, Major)Write a PL/SQL program to read and display the Stuid and Name for the student with stuid=5.arrow_forwardWhat is the use of the GROUP BY clause in SQL?arrow_forward
- In what situations might the SOUNDEX function be useful in SQL when querying text data?arrow_forwardImagine a student table with following columns: Student(Stuid, Name , Age, Major)Write a PL/SQL program to create a cursor and to display all the records from student table.arrow_forwardConsider the following table: Instructor (Instructor_Id, Instructor_Name, specialization, Address, #Department_Id) Write in PL/SQL a function named NumberInstructor_department that takes the id of a department as an input parameter and returns the number of instructors who are working in that department.arrow_forward
- Don't copy from othersarrow_forwardUse the following table to find the OUTPUT of the following SQL queries: Table Name: Patients FIRST NAME SUR NAME BLOOD TYPE SMOKER MEDICAL NO DOB GENDER PHONE FAX WEIGHT PCR TEST 1001 Said Alalawi 12-Jun-2001 Male 98877445 22114454 A 68 NO Negative 1002 Othman Mualla 20-Apr-2000 Male B 78 YES Positive 1003 Sameera Bader 19-Oct-2005 Female 25541122 52 NO Positive 1004 Fahad Alhinai 24-Feb-2004 Male 91122544 AB 66 YES Negative 1005 Shamsa Alfahdi 15-Sep-2002 Female B 35 NO Negative SELECT TO CHAR (DOB, 'DD/YY/MM') FROM patients WHERE Medical no=1001; Answer:arrow_forwardUse the following table to find the OUTPUT of the following SQL queries: Table Name: Patients MEDICAL NO FIRST NAME SUR NAME DOB GENDER BLOOD TYPE PCR TEST PHONE FAX WEIGHT SMOKER 1001 Said Alalawi 12-Jun-2001 Male 98877445 22114454 68 NO Negative 1002 Othman Mualla 20-Apr-2000 Male 78 YES Positive 1003 Sameera Bader 19-Oct-2005 Female 25541122 52 NO Positive 1004 Fahad Alhinal 24-Feb-2004 Male 91122544 AB 66 YES Negative 1005 Shamsa Alfahdi 15-Sep-2002 Female 35 NO Negative SELECT COALESCE (phone, fax, 9999) FROM patients WHERE blood_type='A'; Answer:arrow_forward
- Use the following table to find the OUTPUT of the following SQL queries: Table Name: Patients MEDICAL_NO FIRST NAME SUR NAME DOB GENDER PHONE FAX BLOOD TYPE WEIGHT SMOKER PCR TEST 1001 Said Alalawi 12-Jun-2001 Male 98877445 22114454 A 68 NO Negative 1002 Othman Mualla 20-Apr-2000 Male B 78 YES Positive 1003 Sameera Bader 19-Oct-2005 Female 25541122 52 NO Positive 1004 Fahad Alhinai 24-Feb-2004 Male 91122544 AB 66 YES Negative 1005 Shamsa Alfahdi 15-Sep-2002 Female B 35 NO Negative SELECT SUM (weight) FROM patients WHERE pcr test= 'Positive'; Answer:arrow_forwardUse the following table to find the OUTPUT of the following SQL queries: Table Name: Patients MEDICAL_NO FIRST NAME SUR NAME DOB GENDER PHONE FAX BLOOD TYPE WEIGHT SMOKER PCR TEST 1001 Said Alalawi 12-Jun-2001 Male 98877445 22114454 A 68 NO Negative 1002 Othman Mualla 20-Apr-2000 Male B 78 YES Positive 1003 Sameera Bader 19-Oct-2005 Female 25541122 52 NO Positive 1004 Fahad Alhinai 24-Feb-2004 Male 91122544 AB 66 YES Negative 1005 Shamsa Alfahdi 15-Sep-2002 Female B Negative 35 NO SELECT NULLIF(phone, fax) FROM patients WHERE medical no = 1001; Answer:arrow_forwardWrite three functions in SQL which does the following: The first function should take an integer and convert it into a hexadecimal number. It could also take a hexadecimal number and convert it into an integer. The second function should take an integer and convert it into an octal number. It could also take an octal number and convert it to an integer. The third function should take an integer and convert it into a binary number. It should then take the binary number and convert it into an integer.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr