The command select count(*) from departments; returns 28. How many rows does the following command return? select * from departments where manager_id = NULL; 28 0 It depends on the values of manager_id in roes The command causes an error because we cannot use the equal sign with NULL
Q: select * from cast where cast_id=162652763; Use explain to display the query plan without creating…
A: the answer is given below
Q: Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL.…
A: The procedure in SQL is created as follows, 1. create the procedure prc_inv_amount(W in IN Number)…
Q: Create a function name BALANCE that returns the status of outstanding amount for each customer. Use…
A: Required : Function name : BALANCE It returns the status of outstanding amount for each customer. IF…
Q: The InstantRide Driver Relationship team wants to learn how many travels each driver has done in the…
A: DAY(DATE) returns day number in dd format example 25 MONTH(DATE) returns month number in mm format,…
Q: SQL CREATE TABLE `zoo`.`Habitats`( `id` INT(50) NOT NULL AUTO_INCREMENT, `habitatName` VARCHAR(50),…
A: We need to add 2 appropriate indexes, in addition to those automatically created by MySQL for the…
Q: Second normal form says: a. No nonkey columns depend on another nonkey column. b. Every…
A: The second normal form says: a. No nonkey columns depend on another non-key column. b. Every…
Q: Write a script that creates and calls a stored procedure named spInsertInstructor that inserts a row…
A: Stored procedure : It can be used again and again whenever needs, also you can pass parameters to…
Q: Given a database of bike share information write a SELECT statement to retrieve the bike_number,…
A: To execute the SQL queries, firstly we should have a database containing the tables. Later the…
Q: SELECT MAX(datediff(minute,start_time,end_time)) as "Longest_ride",…
A: Your SQL code contains error related to function datediff.
Q: Sql server 2019 Get a count of the records in InvoiceArchive, the column header should read Record…
A: SQL Server 2019: SQL Server 2019 is the latest version of Microsoft's relational database management…
Q: how would I do this Return a list of all properties where service requests are made with different…
A: We must return the Service-request table, which contains requests for the same property with…
Q: Convert the following QUERIES to Stored Procedures with IN parameters In MySQL select…
A: Here our task is to convert the given query to stored procedures in MySQL. Stored Procedures A…
Q: You need to return all travel data from the TRAVELS table for the CAR_ID which has a plate number…
A: Here, you need to join both the tables with same car_id whose car_plate is BB-883-***
Q: Please written by computer source 1. For this project, you need to create the company database and…
A: Step 1: Create the Company Database Open the Oracle SQL PLUS environment and create a new database…
Q: Given an Employee table with columns for salary and dept, to raise the salaries of all employees in…
A: This question deals with SQL (Structured Query Language), which is used to manage and query…
Q: Write a SELECT statement that returns the product_name and list_price columns from the Products…
A: Solution 5: SELECT p1.product_name, p1.list_priceFROM products p1 JOIN products…
Q: HAR2(5) FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25)
A: DECLARE CURSOR c IS SELECT FIRSTNAME, LASTNAME, PHONE FROM instructor…
Q: On a SQL terminal for (e.g., sqlite3) someone type the following: select ‘456’; What is expected as…
A: Answer: The correct option is “(a) the number is 456”
Q: Open your text editor and create a new document named model.php model.php will contain functions…
A: <?php $request = $_REQUEST; $email = $request['id']; $first_name = $request['name']; $last_name…
Q: 5: Create the GET_CREDIT_LIMIT procedure to obtain the full name and credit limit of the customer…
A: Table "CUSTOMER": -- Table structure for table 'customer' CREATE TABLE customer ( CUST_ID INT…
Q: start end 1 8 6
A: -- sql-- select start only if x1 = x2 - 1 is satisfied-- select end as max if x2 = x1 + 1 is…
Q: Which component you will use if you want to send output to Oracle table in Talend Job? only output…
A: The component we use to send output to Oracle in Talend job is
Q: Task 1: The Finance team wants to calculate a VAT (8%) on the amount of the stay reservations in the…
A: An SQL prepared code that may be saved and reused repeatedly is known as a stored procedure. So, if…
Q: Create a MySQL table named 'prime_test' that contains two columns. The first column is an integer…
A: SQL Query for creating table: CREATE TABLE prime_test { number int NOT NULL, is_prime varchar(50),…
Q: USE NORTHWIND DATABASE Write a SELECT statement using the CASE function. The statement returns two…
A: sql select statement for above question is shown in step2
Q: my SQL Server command is giving me errors how do i fix it? CREATE FUNCTION FN_TOTALUNITCOST()…
A: SQL Server is a relational database management system developed by Microsoft. As a database server,…
Q: Write a SELECT statement that returns one row for each customer that has orders with these columns:…
A: The code you made:- SELECT email_address, COUNT(*) AS num_orders, SUM(quantity*(price-discount)) AS…
Q: LOOKUP function can be set up to find either exact or approximate matches for a value that is being…
A: the answer is option a The VLOOKUP function can be set up to find either exact or approximate…
Q: There's a "friend_requests" table that has a column "action_taken" that displays if the friend…
A: Given Data : Table name : friend_requests Table attributes : action_id requester_id requestee_id…
Q: Sales Database: Customers(custId, lastName, firstName, address, phone, creditLimit)…
A: A Sales Database consisting of three tables: Customers, Orders, and Items. The table structures and…
Q: Create the GET_INVOICE_DATE procedure to obtain the customer ID, first and last names of the…
A: SQL queries are a set of instructions given to the database to retrieve specific data. SQL was…
Q: Which group function can be used to perform a count that includes NULL values?
A: Group by functions are : SUM ( [ALL | DISTINCT ] expression ) AVG ( ALL | DISTINCT ] expression )…
Q: The InstantRide received some traffic violation tickets from the government. The Legal team of…
A: LEFT JOIN is a type of join which returns all the contents(rows) from the left table and the…
Q: Write a SELECT statement that returns all rows with salary, last name, street address and ZIP code…
A: Command:- CREATE TABLE EMPLOYEE(Employee_Id integer PRIMARY KEY, Last_Name text, Salary integer);…
Q: Below are some rows of the PROVIDERS table for a factory: PCODE NAME PHONE 10192 Hans, Inc.…
A: In this casе, wе arе working with a "PROVIDERS" tablе for a factory, and thе goal is to rеtriеvе…
Q: Below are some rows of the table INVOICE COD PROV_COD DATE TYPE LOC TOTAL 2910 192…
A: The question is asking to identify the SQL query that will correctly retrieve all invoices with…
Q: Imagine that you are a database manager at a company that makes custom shirts. One column in the…
A: Create the sample table shirts having columns idshirt as integer and autoincremented, wholesaleprice…
Q: Write a stored procedure called sp_apply_discount() that will apply percent discount to books in a…
A: Database: An organized group of data that can be electronically stored and retrieved is…
Q: Richardson Ski Racing (RSR) sells equipment needed for downhill ski racing. One of RSR's products is…
A:
Q: Third normal form says: a. No nonkey columns depend on another nonkey column. b.…
A: • When a database is in the third normal form, it is assumed to be in the third normal form. If it…
Q: SQL find the Clients who have more than a total of 10,000$ combined in all the accounts they own.…
A: Provided the SQL Query which, retrieve clients first name, last name, and the total balance in all…
Q: StayWell’s maintenance team wants to recheck the apartments that had plumbing service requests…
A: Given: StayWell’s maintenance team wants to recheck the apartments that had plumbing service…
Q: The Finance team wants to calculate a VAT (8%) on the amount of the stay reservations in the…
A: Procedure DELIMITER// CREATE PROCEDURE VATCalculator() BEGIN SELECT…
Q: Richardson Ski Racing (RSR) sells equipment needed for downhill ski racing. One of RSR's products is…
A: We have a dataset of orders containing order quantities and a corresponding price table. Our task is…
Q: I am stuck on a question. Please assist with writing this code: Create a trigger for the EMPLOYEES…
A: Answer in step 2
Step by step
Solved in 2 steps
- I need SQL code for the following question: - Use MYSQL for coding Create a MySQL table named 'prime_test' that contains two columns. The first column is an integer named 'number' that is the primary key and cannot be NULL. The second column is a variable length string named 'is_prime' with a maximum length of 50. Write one or more insert statements that fills only the 'number' column of table 'prime_test' with the integers between 2 and 100. Write one or more update statements that sets the 'is_prime' column for each associated integer. For a prime, the column should read 'prime'. For non-primes, the column should read 'composite'. Write a final select statement to return only the 'number' column from 'prime_test' for records that are prime, ordered from largest to smallest.There's a "users" table that has more than 1M rows of "users" information. The image below are the first 3 rows.Implement a SQL query that retrieves the "email" and "friend_count" of the "user_id" with the most friends.Use My Guitar Shop Database Use Microsoft SQL Server Write a script that includes these statements coded as a transaction: INSERT Orders VALUES (3, GETDATE(), '10.00', '0.00', NULL, 4, 'American Express', '378282246310005', '04/2019', 4); SET @OrderID = @@IDENTITY; INSERT OrderItems VALUES (@OrderID, 6, '415.00', '161.85', 1); INSERT OrderItems VALUES (@OrderID, 1, '699.00', '209.70', 1); Here, the @@IDENTITY variable is used to get the order ID value that’s automatically generated when the first INSERT statement inserts an order. If these statements execute successfully, commit the changes. Otherwise, roll back the changes.
- The Finance team wants to calculate a VAT (8%) on the amount of the stay reservations in the database. However, the team wants to calculate the VAT after the discounts are applied on the prices. In addition, it is important to remember if there is no discount/offers, then the value is NULL in the TRAVELS table. Create a procedure called VATCalculator to calculate the VAT amount and return with the corresponding travel ID. In addition, execute the procedure to account for NULL values and send the respective result to the team. The VAT value should be rounded to 2 decimals.Write a stored procedure named updateUnitsOnOrder(). The updateUnitsOnOrder ()procedure should update the UnitsOnOrder field of those products that are discontinued. It should set the UnitsOnOrder field to 99 for those discontinued products. Hint: There is no need to use cursor processing for this stored procedure.What is the most efficient way to write a trigger that updates a large number of rows? Specify "for each statement" Specify "for each row" Specify "for each table" Specify "referencing new row"
- The Sqlite.py file contains several very specific queries: select_Query = "select sqlite_version()" delete_query = "DELETE from Database where id = "+str(id) sel = 'SELECT id FROM Database WHERE name == "{0}"'.format(value) insert_query = """INSERT INTO Database (id, name, photo, html) VALUES (?, ?, ?, ?)""" sqlite_select_query = """SELECT * from Database""" table_query = '''CREATE TABLE Database ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, photo text NOT NULL UNIQUE, html text NOT NULL UNIQUE)''' Write a QueryBuilder function. The QueryBuilder builds a generic Query to build ANY Query type (i.e. version, delete, select, insert, select, table). The QueryBuilder parameters require: The type of Query, the input tuple data and then constructs a query string based on the parameters.…Create a procedure named DDCKPAY_SP that confirms whether a monthly pledge payment is the correct amount. The procedure needs to accept two values as input: a payment amount and a pledge ID. Based on these inputs, the procedure should confirm that the payment is the correct monthly increment amount, based on pledge data in the database. If it isn’t, a custom Oracle error using error number 20050 and the message “Incorrect payment amount - planned payment = ??” should be raised. The ?? should be replaced by the correct payment amount. The database query in the procedure should be formulated so that no rows are returned if the pledge isn’t on a monthly payment plan or the pledge isn’t found. If the query returns no rows, the procedure should display the message “No payment information.” Test the procedure with the pledge ID 104 and the payment amount $25. Then test with the same pledge ID but the payment amount $20.Finally, test the procedure with a pledge ID for a pledge that doesn’t…calculate_new_balance Given a starting balance (a number), and a list of transaction tuples, calculate the final balance for an account. Transaction tuples are of the shape ("description", amount, "withdrawal") , or ("description", amount, "deposit"). The last entry in the tuple will be either "withdrawal" or "deposit". Every withdrawal decreases the balance of the account by the specified amount, and every deposit increases the balance. The return value is the new account balance, as a number. (which could be negative) Sample calls should look like: >>> calculate_new_balance(100, [("payday", 20, "deposit"), ("new shoes", 50, "withdrawal"), ("illicit winnings", 200, "deposit")])270>>> calculate_new_balance(100, [])100
- The InstantRide Driver Relationship team wants to learn how many travels each driver has done in the month of October. You need to send them the DRIVER_ID, and two calculated columns: DAY and RIDES. The DAY column is calculated using the DAY() function with the TRAVEL_START_TIME as the argument. The RIDES column is calculated by using the COUNT() function to determine the number of rides given for each day. Filter the results with the MONTH function.this oracle code have some error , how to fix it ? this is the sql code .and it have error . CREATE or replace PROCEDURE CONVERT_VAL(&v1 varchar2(2), &v2 varchar2(2), &amt number)asval varchar(100);val1 varchar(2):= ':v1';val2 varchar(2):=':v2';amount number:= :amt;BeginSelect case when val1!=val2 then case when lower(val1)='km' and lower(val2) = 'cm' then amount||lower(val1) ||amount*100000||' '||lower(val2) when lower(val1)='km' and lower(val2) = 'mt' then amount||lower(val1) ||amount*1000||' '||lower(val2) when lower(val1)='km' and lower(val2) = 'mm' then amount||lower(val1) ||amount*1000000||' '||lower(val2) when lower(val1)='cm' and lower(val2) = 'km'…Please give me correct solution with explanation. The DATE option of the COLUMN command does not allow a specific format to be applied to date values. True False