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
Question
Chapter 6, Problem 12SCG
Program Plan Intro
Primary key:
- To identify each record in a table, at least there must be one data field, which should be unique.
- That is corresponding data field of every record should be unique.
- It is called primary key.
- Primary key is used to identify the unique record from a collection of records.
“INTEGER” datatype:
- The numeric values with an implied scale of zero is accepted by the “INTEGER” datatype.
- It will store integer value between the range 2^-31 and 2^31-1.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Use %ROWTYPE for your cursor. You will use 3 tables in this activity - departments, locations, and countries.
Write a PL/SQL block to read and display the department name, city and country name from departments 10, 30, and 90.
Display also the number of records returned by your PL/SQL block.
How do I do this question in SQL command?
Use the Oracle database employees table and CASE expression to decode the departmentid. Display the department id, last name, salary, and a column called “New Salary” whose value is based on the following conditions: If the department id is 10 then 1.25 * salary If the department id is 90 then 1.5 * salaryIf the department id is 130 then 1.75 * salary Otherwise, display the old salary.
I am trying to get rid of duplicate rows in SQL. This is the current code I'm using. Please help me to write a code to create a new table without the duplicates.
Select
EmployeeID,
Username,
FirstName,
LastName,
RoleName,
RoleDescription,
Count(*) as '# of Duplicates'
From
[dbo].[vw_MyAccessInfo]
Group by EmployeeID, Username, FirstName, LastName, RoleName,RoleDescription
Having Count(*) > 1
Select * from [dbo].[vw_MyAccessInfo]
Select distinct * from [dbo].[vw_MyAccessInfo]
Chapter 6 Solutions
A Guide to SQL
Ch. 6 - Prob. 1RQCh. 6 - Which command and clause adds an individual row to...Ch. 6 - How do you add data from an existing table to...Ch. 6 - Prob. 4RQCh. 6 - Which command removes rows from a table?Ch. 6 - Which command makes updates permanent?Ch. 6 - Which command reverses updates? Which updates are...Ch. 6 - Prob. 8RQCh. 6 - What is the format of the SET clause that changes...Ch. 6 - Which command and clause adds a column to an...
Ch. 6 - Prob. 11RQCh. 6 - Which command deletes a table and all its data?Ch. 6 - Prob. 13RQCh. 6 - Prob. 1TDCh. 6 - Prob. 2TDCh. 6 - Prob. 3TDCh. 6 - Prob. 4TDCh. 6 - Prob. 5TDCh. 6 - Prob. 6TDCh. 6 - In the NONGAME table, change the category for item...Ch. 6 - Prob. 8TDCh. 6 - Prob. 9TDCh. 6 - Prob. 10TDCh. 6 - Prob. 11TDCh. 6 - Use SQL to make the following changes to the...Ch. 6 - Prob. 2CATCh. 6 - Prob. 3CATCh. 6 - Prob. 4CATCh. 6 - Prob. 5CATCh. 6 - Prob. 6CATCh. 6 - Add to the PADDLING table a new character column...Ch. 6 - Prob. 8CATCh. 6 - Prob. 9CATCh. 6 - Prob. 10CATCh. 6 - Prob. 11CATCh. 6 - Prob. 12CATCh. 6 - Use SQL to make the following changes to the...Ch. 6 - Prob. 2SCGCh. 6 - Prob. 3SCGCh. 6 - Prob. 4SCGCh. 6 - Prob. 5SCGCh. 6 - Prob. 6SCGCh. 6 - Prob. 7SCGCh. 6 - Prob. 8SCGCh. 6 - Prob. 9SCGCh. 6 - Prob. 10SCGCh. 6 - Prob. 11SCGCh. 6 - Prob. 12SCG
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
- Please ensure that you include the result table as well as your SQL; you can copy and paste this from either your ssh client or SQL Developer. These tables exist in arion and are owned by the user dtoohey. You may, if you wish, create your own copies of the tables under your own account. If you do so, you should ensure that you copy the sample data in dtoohey’s tables. These queries are based on the View Ridge Gallery database you have been using in the Lab sessions. Please see Chapters 6 and 7 of Kroenke for background to the case and table structures. The sum of the acquisition price of works of art for each year (for example, if there were two works of art purchased for $1500 and $1000 in 2019, and one work of art purchased for $500 in 2020, then the sums would be $2500 and $500, for 2019 and 2020 respectively). Which artist has had the most works of art sold, and how many of the artist’s works have been sold?arrow_forwardSolmaris is offering a monthly discount for owners who pay their condo fees on a quarterly basis. The discount is 1.75 percent of the monthly fee. For each condo, list the location number, unit number, owner number, owner’s last name, condo fee, and discount. The discount should be rounded to the nearest dollar. Snip and paste the SQL command(s) and results below. SQL includes many numerical functions. Two of these functions are FLOOR and CEIL. Use the Internet to research these functions. Are the functions available in Oracle, SQL Server, and Access? Write a paragraph that discusses what the functions do and any differences and/or similarities between the functions in Oracle, SQL Server, and Access. Then perform the following tasks: Solmaris Condominium Group would like to know the impact of discounting its condo fees by 3 percent. Write an SQL statement in MySQL that displays the condo ID, unit number, discounted condo fee, discounted condo fee with the CEIL function, and…arrow_forwardPlease help with the following: Using oracle sql live or sql developer what sql statements could be use to find the following: A simple database composed of the following tables: PATIENT, DOCTOR, DRUG, and PRESCRIPTION, is now loaded with this assignment and you are ready to start. Please explore the database and then write the appropriate SQL command. 1. List all the rows in which the prescription dates occur on or after November 14. 2. How many doctors provide prescriptions with 30 tablets in total? Beginfor c in (select table_name from user_tables) loopexecute immediate ('drop table '||c.table_name||' cascade constraints');end loop;End;//* */ ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY';CREATE TABLE DOCTOR (DOC_ID varchar2(5) PRIMARY KEY,DOC_LNAME varchar2(15),DOC_FNAME varchar2(15),DOC_INITIAL varchar2(1),DOC_SPECIALTY varchar2(15));INSERT INTO DOCTOR VALUES('29827','Sanchez','Julio','J','Dermatology');INSERT INTO DOCTOR…arrow_forward
- Using sqlarrow_forwardYou are working with a database table that contains invoice data. The table includes columns for invoice_id and invoice_date. You want to remove duplicate entries for invoice_date. You write the SQL query below. Add a DISTINCT clause that will remove duplicate entries from the invoice_date column.arrow_forwardComplete the following Updating Data Activities using SQL. After completing the required SQL activity, use a Select clause after each activity to display the fields changed to prove the results is correct. 1. Change the description of part BT04 to Oven. 2. Add $100 to the credit limit of every customer represented by sales rep number 06. 3. Add order 12600 (order date: 09/06/2018, customer number: 311) to the database. Add two order lines to this order. On the first line, the part number is AX12, the number ordered is 5, and the quoted price is $13.95. On the second line, the part number is BA74, the number ordered is 3, and the quoted price is $4.50. 4. Write the command to delete every customer whose balance is $0 and who is represented by sales rep 12. Do not execute the command. 5. Create a new table named SPGOOD to contain the columns PART_NUMBER, DESCRIPTION, and UNIT_PRICE. Then insert into this new table the part number, part description, and unit price from the PART table…arrow_forward
- Use FOR loop for your cursor. Write a PL/SQL block to read and display the job_id and number of employees per job_id. Accept input from the user to get the number of employees he wants to see in the output. Display also the number of records returned by your PL/SQL block.arrow_forwardWrite a PL/SQL using a cursor with Basic loop to update the Price attribute of all flight records inFlight table according to the following conditions: 1- If the FName is Oman Air, change price to 500.2-If the FName is Emirates, change price to 200.3- If the FName is Air India, change price to 250.arrow_forwardUsing SQL: List the CD title (i.e. `Title` field of `Titles` table) and the number of tracks (NOT `TrackNum` field) for any title with fewer than 9 tracks.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781285196145Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos CoronelPublisher:Cengage LearningDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage Learning
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning