Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Subject:
Write the SQL statements for following modification tasks:
a) Add constraint to the table BORROWER named borrower_cardno_pk to create the attribute name as the primary key.
b) Delete the column city from the table BORROWER
c) Modify the column of "phone" in table BORROWER, change the data type into type of VARCHAR2 with length of 20.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps
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
- Question 11 Write SQL statements to answer the following question based on the ERD below. Note: Display only the attribute(s) required in the question. You need to provide complete answers, writing just keywords like SELECT, FROM, WHERE will receive 0 point. Question: List course name, section ID, and the average student grade (as GPA) in that section, for each section that was offered in 'Spring 2010' and order the result in descending order of section ID. STUDENT PK G_number FirstName LastName Address REGISTRATION PK FK G_number PK FK Sectionid DateEnrolled Grade 140 (DC) ALT+N+F10 (Mac) COURSE PK CourseID PK CourseName Course Desc CourseDept F SECTION SectionID FK Course D Semester Year Է t + 78v ABC > 5 600arrow_forwardWrite and execute a SQL query to list all patient numbers and encounter ids which do not have any data (missing rows) in VisitSummary table. Order the result by patient number, encounter id. Write and execute a SQL query to list all patients whose information about race or gender has changed during their future visits. A future visit is defined as T1.encounter_id < T2.encounter_id. Your output should have patient number, old and new race values, old and new gender values, and the encounter ids. Write and execute a SQL query to list all the patient data for all encounters. Even if patient data is missing in other tables, you still need to list the patient_nbr and encounter_id in your output. Your output should list all the columns (without repeating them) starting with encounter_id, patient_nbr... and it should be ordered by patient_nbr and then encounter_id. Write and execute a SQL query to list all the patient data for all encounters. If the patient data is missing…arrow_forwardWrite an SQL query using the ALTER TABLE and ADD operator to add anattribute named ORDERDATE with the constraint of Varchar 55arrow_forward
- Use SQL Developer or Oracle Live SQL to write the appropriate SQL commands as follows: ) PROCEDURE: Use the cust_node table to create a procedure called ‘Get_node_id’ that takes the cust_idas an input parameter to show its corresponding node id to the banker. Then execute this procedure withcust_id=5.arrow_forwardWhat use cases are best suited for the CROSS APPLY function in SQL?arrow_forwardDo a SQL query using their data format to see who hasn't attended any classes there. Please avoid using set operations and subqueries (use an outer join).arrow_forward
- Refer to the film and inventory tables of the Sakila database. The tables in this lab have the same columns and data types but fewer rows. Write a query that lists the titles of films with the fewest rows in the inventory table. This query requires a subquery that computes the minimum of counts by film_id: SELECT MIN(count_film_id) FROM ( SELECT COUNT(film_id) AS count_film_id FROM inventory GROUP BY film_id ) AS temp_table; This subquery is provided in the template.arrow_forwardTask 2: The Car Maintenance team also wants to store the actual maintenance operations in the database. The team wants to start with a table to store CAR_ID (CHAR(5)), MAINTENANCE_TYPE_ID (CHAR(5)) and MAINTENANCE_DUE (DATE) date for the operation. Create a new table named MAINTENANCES. The PRIMARY_KEY should be the combination of the three fields. The CAR_ID and MAINTENANCE_TYPE_ID should be foreign keys to their original tables. Cascade update and cascade delete the foreign keys. SQL DataBase Test: Create a new table to store maintenance operations Test Query: DESCRIBE MAINTENANCES Expected Results Field Type Null Key Default Extra CAR_ID char(5) NO PRI NULL MAINTENANCE_TYPE_ID char(5) NO PRI NULL MAINTENANCE_DUE date NO PRI NULLarrow_forwardINFO 2303 Database Programming Assignment : PL/SQL Practice Note: PL/SQL can be executed in SQL*Plus or SQL Developer or Oracle Live SQL. Write an anonymous PL/SQL block that will delete all patients for doctors that works in the Family Practice Verify that patients have been deleted accordingly. Then do a select * from patients where doc_id = (select doc_id from doctor where area = ‘Family Practice’. You should get no rows.arrow_forward
- CREATE TABLE Employee( firstName char(30) , lastName char(30) , hireDate date ,empNo int , empInitial char(30) , years int ); Write the SQL syntax to create an insert statement for the employee table you created above.arrow_forwardCreate a function to insert a new product into an existing order, include the product id, unit price, quantity. The output of the function is the message to notify the calling program whether the update succeeded or not. note : Note: Sql code need not java don't waste my time by giving java codearrow_forwardWrite an SQL query using the NOT operator that will show all employeeinformation from the Employee table with the exception of EmployeeNumber 7344.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education