A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 3, Problem 12RQ
Explanation of Solution
Difference between “CHAR” and “VARCHAR”:
CHAR | VARCHAR |
“CHAR” is fixed length data type. | “VARCHAR” is the variable length data type. |
The storage size is equal to the maximum size of the column. | The storage size is equal to the actual length of the data. |
The keyword “CHAR” is used to declare the variable... |
Explanation of Solution
Appropriate place to use “CHAR” data type:
The “CHAR” data type is a good choice when storing the initial of the name as it takes up the same amount of bytes. It is also suitable to specify the name of the individual as it hold only the list of characters.
Example:
CREATE TABLE EMPLOYEE (
EMP_NU...
Explanation of Solution
URL:
The following given URL provides the examples as referen...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
example inn 100 sqlmstatement
Need to create two store procedures with help.
Problem
Your task is to write an SQL query that uses SQL's time constants to
dynamically determine the timezone the database server is
configured to use.
Your query should return the timezone as a single string value with
the timezone offset relative to the Coordinated Universal Time
(UTC). The single output column should be named tz_offset, and
the value should be in the form:
UTC:
where and use two digits in 24-hour format,
padded with leading zeroes if necessary.
Example: if the server used India's timezone the output should be:
| tz_offset |
| UTC+05:30
(1 row)
query.sql> init.sql
1
Chapter 3 Solutions
A Guide to SQL
Ch. 3 - Prob. 1RQCh. 3 - How do you delete a table using SQL?Ch. 3 - Prob. 3RQCh. 3 - Prob. 4RQCh. 3 - Prob. 5RQCh. 3 - Prob. 6RQCh. 3 - Prob. 7RQCh. 3 - Prob. 8RQCh. 3 - Prob. 9RQCh. 3 - Prob. 10RQ
Ch. 3 - Prob. 11RQCh. 3 - Prob. 12RQCh. 3 - Prob. 13RQCh. 3 - Use SQL to complete the following exercises....Ch. 3 - Prob. 2TDCh. 3 - Prob. 3TDCh. 3 - Prob. 4TDCh. 3 - Prob. 5TDCh. 3 - Prob. 6TDCh. 3 - Prob. 7TDCh. 3 - Prob. 1CATCh. 3 - Add the following row to the ADVENTURE_TRIP table:...Ch. 3 - Prob. 3CATCh. 3 - Prob. 4CATCh. 3 - Prob. 5CATCh. 3 - Prob. 6CATCh. 3 - Review the data for the TRIP table in Figure 1-5...Ch. 3 - Colonial Adventure Tours would like to increase...Ch. 3 - Prob. 1SCGCh. 3 - Add the following record to the VACATION_UNIT...Ch. 3 - Delete the VACATION_UNIT table.Ch. 3 - Prob. 4SCGCh. 3 - Prob. 5SCGCh. 3 - Prob. 6SCGCh. 3 - The SERVICE_REQUEST table uses the CHAR data type...
Knowledge Booster
Similar questions
- The SERVICE_REQUEST table uses the CHAR data type for the DESCRIPTION and STATUS fields. Is there an alternate data type that could be used to store the values in these fields? Justify your reason for choosing an alternate data type or for leaving the data type as CHAR.arrow_forwardWhat is a NULL value?arrow_forwardDelete the index named ITEM_INDEX3.arrow_forward
- What happens if you try to decrease the scale or precision of a NUMBER column to a value less than the data already stored in the field?arrow_forwardBelow is part of a Student database. The primary keys are highlighted in bold. Student (studNo, studName, address, mobileNo) Registration (studNo, courseNo, regDate, semester, session) Course (courseNo, courseName, creditHour, level) Project (projNo, projName, courseNo) Assignment (projectNo, studNo, startDate, dueDate, hoursSpent) QUESTION 1. Write a PL/SQL FUNCTION that calculates the cost each student has to pay for all courses taken. In the photo is example the cost detail for each course. 2. Write a PL/SQL Procedure to call the function you created in question 1 . Allow the user to enter the student ID (studno). SECOND PHOTO IS THE EXAMPLE OF EXPECTED OUTPUTarrow_forwardSQL : Write a statement that allows the same classmate to modify (insert, update, and delete) the data of the newEmpXX tablearrow_forward
- 1-Write the syntax to insert into a relational table called students the address column references an object table called addresses that was created using an address_type. Other columns exist in the students table, but you are only inserting into the ones below. Aliases used should be the first letter of the table name, eg students would be s, addresses would be a Relational Table Name students attribute student_id attribute surname attribute addressarrow_forwardPATHS is a table that contains information about paths on a number line. The structure of PATHS is as follows, where x1 and x2 represent that there is a path from Coordinate x1 to Coordinate x2 (You can't move from Coordinate x2 to Coordinate x1 ). NAME ΤΥΡE NULLABLE X1 INT FALSE X2 INT FALSE Problem Please write an SQL statement that returns the beginning and end point of each path in PATHS . Sort them by the value of the beginning point in ascending order. Constraints • In the case where a direct path from Coordinate a to Coordinate b is available, no path from Coordinate b to Coordinate a will be given. |x1-x2| = 1 • No path will overlap with one another. Example Suppose that PATHS is as follows: x1 x2 1 2 2 3 4 7 7 6 This table can be visualized as follows: START END END START 7 8. 9 Therefore, your SQL statement must return the following: start end 1 4 8 6arrow_forwardSBN Title Author 12345678 The Hobbit J.R.R. Tolkien 45678912 DaVinci Code Dan Brown Your student ID DBS311 Your Name use the following statement to Write a PL/SQL Function that accepts 4 parameters, 2 strings representing students names, and 2 integers representing the marks they received in DBS311. The function will determine which student had the higher mark and return the name of the student. If the marks were the same, then return the word "same" and return "error" if an error occurs or the calculation can not be determined.arrow_forward
- In SQL Server, character data types may be distinguished as follows: NVARCHAR, NVARCHAR, and NVARCHAR.arrow_forwardBelow is part of a student database for your reference. The primary keys are highlighted in bold. Student (studNo, studlvame, address, mobileNo) Registration (studNo, courseNo, regDate, semester, session) Course (courseNo, courseName, creditHour, level) Project (projNo, projName, courseNo) Assignment (projNo, studNo, startDate, dueDate, hoursSpent) Fill the empty lines (Line 10, 12, 22, 23, 27) with the appropriate PL/SQL code so as to complete the following anonymous block. The anonymous block displays the list of courses taken by a certain student. Allow the user to enter the STUDENT NAME: 1. ACCEPT studname PROMPT 'Enter the student name:' 2. 3. DECLARE 4. v_cid course.courseno%TYPE; 5. V_sname student.studname%TYPE:= '&studname; 6. V_cname course.coursename%TYPE; 7. 8. CURSOR course_list IS 9. SELECT c.courseno, c.coursename 10. 11. WHERE s.studno = r.studno 12. 13. AND studname = V_sname; 14. 15. BEGIN 16. 17. OPEN course_list; 18. 19. DBMS_OUTPUT.PUT_LINE(List of courses for…arrow_forwardDo this in MySQL please: Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL amounts for the invoice, the INV_TAX is the product of the INV_SUBTOTAL and the tax rate (8 percent), and the INV_TOTAL is the sum of the INV_SUBTOTAL and the INV_TAX.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 PtrNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L