1. Write a query that will show all probation officers 2. Write a query that will show the first and last names of probation officers 3. Now write a query that shows first and last name of probation officers. Include the field prob_id but rename prob_id to probation officer ID.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
DROP TABLE criminals CASCADE CONSTRAINTS;
DROP TABLE crimes CASCADE CONSTRAINTS;
CREATE TABLE criminals
(criminal_id NUMBER(6),
last VARCHAR2(15),
first VARCHAR2(10),
street VARCHAR2(30),
city VARCHAR2 (20),
state CHAR(2),
zip CHAR(5),
phone CHAR(10),
v_status CHAR (1) DEFAULT 'N',
P_status CHAR(1) DEFAULT 'N' );
CREATE TABLE crimes
(crime_id NUMBER (9),
criminal_id NUMBER (6),
classification CHAR(1),
date_charged DATE,
status CHAR(2),
hearing_date DATE,
appeal_cut_date DATE);
ALTER TABLE crimes
MONTEV (laccification DEFAULT
CityJail_5 (2) (1) - Notepad
File Edit Format View Help
ALTER TABLE crimes
12.103
MODIFY (classification DEFAULT 'U');
ALTER TABLE crimes
ADD (date_recorded DATE DEFAULT SYSDATE);
ALTER TABLE criminals
ADD CONSTRAINT criminals_id_pk PRIMARY KEY (criminal_id);
ALTER TABLE criminals
13064CAR
ADD CONSTRAINT criminals_vstatus_ck CHECK (v_status IN('Y', 'N'));
ALTER TABLE criminals
ADD CONSTRAINT criminals_pstatus_ck CHECK (p_status IN('Y', 'N'));
TALTER TABLE crimes
ADD CONSTRAINT crimes_id_pk PRIMARY KEY (crime_id);
ALTER TABLE crimes
ALTER TABLE crimes
MODIFY (criminal_id NOT NULL);
ADD CONSTRAINT crimes_class_ck CHECK (classification IN('F', 'M', '0', 'U').
ALTER TABLE crimes
ADD CONSTRAINT crimes_status_ck CHECK (status IN('CL', 'CA', 'IA'));
ALTER TABLE crimes
ADD CONSTRAINT crimes_criminalid_fk FOREIGN KEY (criminal_id)
REFERENCES criminals (criminal_id);
Transcribed Image Text:DROP TABLE criminals CASCADE CONSTRAINTS; DROP TABLE crimes CASCADE CONSTRAINTS; CREATE TABLE criminals (criminal_id NUMBER(6), last VARCHAR2(15), first VARCHAR2(10), street VARCHAR2(30), city VARCHAR2 (20), state CHAR(2), zip CHAR(5), phone CHAR(10), v_status CHAR (1) DEFAULT 'N', P_status CHAR(1) DEFAULT 'N' ); CREATE TABLE crimes (crime_id NUMBER (9), criminal_id NUMBER (6), classification CHAR(1), date_charged DATE, status CHAR(2), hearing_date DATE, appeal_cut_date DATE); ALTER TABLE crimes MONTEV (laccification DEFAULT CityJail_5 (2) (1) - Notepad File Edit Format View Help ALTER TABLE crimes 12.103 MODIFY (classification DEFAULT 'U'); ALTER TABLE crimes ADD (date_recorded DATE DEFAULT SYSDATE); ALTER TABLE criminals ADD CONSTRAINT criminals_id_pk PRIMARY KEY (criminal_id); ALTER TABLE criminals 13064CAR ADD CONSTRAINT criminals_vstatus_ck CHECK (v_status IN('Y', 'N')); ALTER TABLE criminals ADD CONSTRAINT criminals_pstatus_ck CHECK (p_status IN('Y', 'N')); TALTER TABLE crimes ADD CONSTRAINT crimes_id_pk PRIMARY KEY (crime_id); ALTER TABLE crimes ALTER TABLE crimes MODIFY (criminal_id NOT NULL); ADD CONSTRAINT crimes_class_ck CHECK (classification IN('F', 'M', '0', 'U'). ALTER TABLE crimes ADD CONSTRAINT crimes_status_ck CHECK (status IN('CL', 'CA', 'IA')); ALTER TABLE crimes ADD CONSTRAINT crimes_criminalid_fk FOREIGN KEY (criminal_id) REFERENCES criminals (criminal_id);
HW2: Basic SQL
1. Write a query that will show all probation officers
2. Write a query that will show the first and last names of probation officers
3. Now write a query that shows first and last name of probation officers. Include the field prob_id
but rename prob_id to probation officer ID.
4. Write a query that will show crime id, and the total charges for each crime ID. Include an alias
for the total charges column called Total Charges.
5. Write a query that will concat the last and first names of criminals into one column. Add a space
and comma between the last and first name of criminals. Give the column the alias Criminal
Name.
6. List the last name and first name of all authors in only 1 column. Add a comma to separate the
two names.
7. Run a query that will return the order#, item#, isbn, quantity, paideach. Include in the query a
arithmetic operation that will total quantity and paideach. Alias the virtual column so it is
labeled Item Total
Transcribed Image Text:HW2: Basic SQL 1. Write a query that will show all probation officers 2. Write a query that will show the first and last names of probation officers 3. Now write a query that shows first and last name of probation officers. Include the field prob_id but rename prob_id to probation officer ID. 4. Write a query that will show crime id, and the total charges for each crime ID. Include an alias for the total charges column called Total Charges. 5. Write a query that will concat the last and first names of criminals into one column. Add a space and comma between the last and first name of criminals. Give the column the alias Criminal Name. 6. List the last name and first name of all authors in only 1 column. Add a comma to separate the two names. 7. Run a query that will return the order#, item#, isbn, quantity, paideach. Include in the query a arithmetic operation that will total quantity and paideach. Alias the virtual column so it is labeled Item Total
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY