Write SQL code which declares two variables for name and address. Store your name and address in respective variables. Display name and address in a single line using print statement.
Q: 1. Write the SQL statements to run the following commands: i. Create table Staff with the fields…
A: Here is the all sql query of above problem. See below step for code.
Q: 5. Use XAMPP Control Panel (My SQL) to answer the following questions. Write SQL queries statement…
A: CODE:- Creating table PROPERTY and inserting values in it:- -- create table PROPERTY CREATE…
Q: Create a sql procedure which takes part of a book title as input. When the procedure is called, it…
A: The database is the collection of data and information. SQL is the Structured Query language that is…
Q: Exercise 1: Addresses in Bahrain are identified using three numbers separated using commas and one…
A:
Q: Write the corresponding syntax of the given SQL statements. Using COUNT Clause
A: Given: Write the corresponding syntax of the given SQL statements. Using COUNT Clause
Q: Write a PL/SQL block of code that performs the following tasks: Read a Book id provided by user at…
A: I have used PL/SQL Cursors to solve the given problem SET SERVEROUTPUT ON; DECLARE v_author…
Q: 15. Let's update the total credit for yourself to 45. Use the update statement to do that. You can…
A: 1. Before Executing Query : UPDATE student SET tot_cred='45' WHERE ID='43123'; After Executing…
Q: Please develop PL/SQL program that asks for a radius of a cirle. After user enters a radius number,…
A: Below is the required PL/SQL program: - Approach: - Declare the variable to store the…
Q: In SQL, write the appropriate statements to insert default values for these three tables, each table…
A: Prescription table: INSERT INTO prescription (pre_no,pre_date,pre_amount)VALUES (10,12,1200); INSERT…
Q: Question 11. Write the SQL statement that will implement the relational algebra expressions in the…
A: The queries are given below
Q: Computer Science * IN SQL* Write an SQL statement that selects all customers with a city starting…
A: selects all customers with a city starting with any character, followed by "land".
Q: SalesPerson (salesPersonId, salespersonLastName, dateOfBirth, gender, city, state, zipCode, salary)…
A: The above queries require knowledge of Inner Join in SQL. The INNER JOIN keyword selects records…
Q: Write SQL statement to perform the following : A)Display these three columns ( FIRST_NAME ,…
A: There are total 3 sub - questions given, A)Display these three columns ( FIRST_NAME , LAST_NAME ,…
Q: 3) Write a valid SQL statement that calculates the total weight of all ears of corn that were picked…
A: The Answer is
Q: AL Distributors would like to know the number of months between the current date and the order date…
A: According to the Question below the Solution:
Q: Write SQL queries for the following. Display full name of doctors whose first name is other than…
A: Structured Query Language is abbreviated as SQL or also pronounced as See-Qwell. It is developed for…
Q: Exercise 1: Addresses in Bahrain are identified using three numbers separated using commas and one…
A: According to bartleby guidelines we need to solve only the first question, so please repost the…
Q: Write a SQL statement to insert NULL values against region_id column for a row of countries table. •…
A: According to the Question below the Query:
Q: Write in SQL a command that creates the table Supplier according to the above description . Write in…
A: Note: since your question contain multiple-sub parts question but we can answer only first 3-sub…
Q: 5. Use XAMPP Control Panel (My SQL) to answer the following questions. Write SQL queries statement…
A: Query:- SELECT location, COUNT(location)FROM propertyGROUP BY locationHAVING COUNT(location)
Q: 17. Write the SQL statement that will display the following (do not hardcode 'George', 'Lorraine',…
A: Using self join between these two table we will get the results for George and Lorraine and to…
Q: develop a PL/SQL block that selects the maximum department ID in the departments table and stores it…
A: PL/SQL(Procedural Language / Structured Query Language) is the embedded procedural language and the…
Q: 1. Write a SQL function that accepts a principal mortgage amount, an annual percentage rate (APR),…
A: Short Summary: It appears that the formula you pasted here is not correct due to formattting issue…
Q: Examine the STUDENTS table and the given SQL statement: EID Name Dept Salary 1001 Aminah…
A: According to given condition, _a% In the STUDENTS table Zainab contains a at second position. And…
Q: Write a PL/SQL block that uses searched CASE statement to classify students based on their scores in…
A: The SEARCHED CASE statement is similar to the CASE statement, rather than using the selector to…
Q: id name supervisor A John Joyce Jim Jennifer Peter D null E C E Write an SQL statement to list any…
A: We can achieve the desired result by doing self join of the Employee table
Q: Write dynamic SQL statements: a) Based on controls on the main search screen, write SQL statement to…
A: a) write dynamic SQL statements: a)Based on the controls of main search screen, write SQL statement…
Q: Write a SQL function that accepts a principal mortgage amount, an annual percentage rate (APR), and…
A: Answer is given below .
Q: Do the steps below in microsoft SQL server management studio. -create Authors and Books relations.…
A: Note : As you have posted multiple sub-parts, I am answering 1st 3 sub parts according to the…
Q: T-SQL procedure for MICROSOFT SQL SERVER A: obtain the name and credit limit of the customer…
A: Given : T-SQL procedure for MICROSOFT SQL SERVER A: obtain the name and credit limit of the customer…
Q: Write a procedure which takes customer id as argument and return name of customer and his/her total…
A: Question : -Write a procedure which takes customer id as argument and return name of customer and…
Q: Task 2: Write a function that returns how old a book is Published before 2000 ->Book X by author Y…
A: SELECT * FROM ( SELECT CONCAT(a.fname, ' ', a.lname), b.title,…
Q: T-SQL procedure A: obtain the name and credit limit of the customer whose number currently is…
A: PART A:- CREATE OR REPLACE PROCEDURE DISPLAY_CUSTOMER_NUM (I_CUSTOMER_NUM IN…
Q: ASSUME 6.2 IS DONE Write a SQL statement to get the list of all the tasks that started after…
A: Let's understand step by step : 1. Here given that 6.2 is already done so 6.2.1 : Task table is…
Q: Write SQL or PL/SQL scripts for the following: 1) write an anonymous block program unit that show…
A: i have provided this answer in step-2. as per question i dont have any data in question so i…
Q: You are working with a database table that contains customer data. The table includes columns about…
A: Introduction You are working with a database table that contains customer data. The table includes…
Q: . Write SQL retrieval commands for each of the following queries: a. Display the course ID and…
A: Actually, SQL stands for Structured Query
Q: Write the SQL query that will produce a list of customers who have an unpaid balance.
A: Given, In a table, the last name, first name, initial, and an unpaid balance of each customer is…
Q: .use sql to Write a SQL query from the following data (as shown below)to display the number of…
A: 1. Display the number of the customer with a total amount over all orders average SELECT…
Q: Use the table below to find the output PRODUCT ID PRODUCT NAME BRAND UNIT PRICE SUPPLIER ID CATEGORY…
A: Required:
Q: 8. Write a Relational Algebra expression to represent the following SQL statement: select building,…
A:
Q: Student Subject STU_number Registration SUB_Code STU_Name STU_Suname STU DOB STU_Number SUB_Code…
A: NOTE: As per our guidelines, we are suppose to answer only first three subparts. Kindly repost the…
Q: use the following statement to Write a PL/SQL Function that accepts 4 parameters, 2 strings…
A: DECLAREStudent1 varchar2(32767);Student2 varchar2(32767);S1Marks number;S2Marks number;c…
Q: q5) Examine the EMPLOYEES table and the given SQL statement: EID Name Dept Salary 1001…
A: I have answered the question in step 2.
Q: write Sql statements to write query for the given table .. the query statements are. Display first…
A: Structured Query Language is abbreviated as SQL or also pronounced as See-Qwell. It is developed for…
Q: Write a SQL function that accepts a principal mortgage amount, an annual percentage rate (APR), and…
A: Actually, SQL stands for Structured Query Language.
Q: 5. Use XAMPP Control Panel (My SQL) to answer the following questions. Write SQL queries statement…
A: Here we have given queries for creating tables and assigned primary and foreign keys. You can find…
Q: trying to make recursive SQL statement to get the days of the week , can you tell me what does not…
A: Introduction: In SQL, DATENAME() function returns a string. NVARCHAR type, that represents a…
Q: 1.Question Workspace Write an SQL query that displays the therapies and their unit of time for…
A: According to company policies I am compelled to solve only one question and that is the first…
Q: Given the following relation: Movie (MovieID, Title, Genre, Year) Write a PL/SQL block of code that…
A: Given: Movie (MovieID, Title, Genre, Year) Write a PL/SQL block of code that performs the following…
Write SQL queries for the following statements.
1) Write SQL code which declares two variables for name and address. Store your name and address in respective variables. Display name and address in a single line using print statement.
2) Display table of 10 in given format using
10 x 1 = 10
10 x 2 = 20
.
.
.
10 x 10 = 100.
3) Write a code which declares a variable and stores age of youngest employee from “Employee” table. And display name of youngest employee 5 times his.
4) Assume that in “Employee” table, Emp_id are assigned from 1 to onward. ie first employee’s eid is 1, second employee’s eid is 2 and so on. Write a code that displays name of eldest employee without using aggregate function of “max”. You can use count function
Step by step
Solved in 2 steps
- Can you Write the SQL statements to do the following please : 1. Display the artist's name from the Artist table in uppercase.2. Display the person's Key, First Name, Last Name and Area Code (first 3 digits of the phone number) from the Person table and label the output as such. 3. Display the current date and five days from that date.4. Display the difference between the current date and the PurchaseDate of the Inventory.5. Display the day of the week, in words, on which the Purchases were place. (Hint: Use datepart dw.)6. Display the minimum, maximum, sum, average, count fields, count records for the SaleDetailPrice from the SaleDetail table. Appropriately label the output.7. Display the count of phone numbers in the Person table.8. Display the record count of the Person table.write Sql statements to write query for the given table .. the query statements are. Display first name of doctors whose first name contains any of vowels (a,e,i,o,u). Display names of those patients whose name’s second letter is neither ‘a’ nor ‘d’ Display details of those patients whose name contains less than 5 characters. Display first 4 doctors who are earning least salary. Display details of all patients in such a way that female patients are shown before male patients. Display names of those patients whose names starts with either ‘a’ or ‘b’ or‘d’ and don’t ends on‘s’. Display 1/4 records of patients.The following two SQL statements will produce the same results. SELECT P_DESCRIPT, P_QOH,P_PRICE FROM PRODUCT WHERE P_QOH >(SELECT P_QOH FROM PRODUCT WHERE P_CODE='11QER/31') AND P_PRICE>(SELECT P_PRICE FROM PRODUCT WHERE P_CODE='11QER/31'); SELECT P_DESCRIPT, P_QOH,P_PRICE FROM PRODUCT WHERE (P_QOH,P_PRICE) > (SELECT P_QOH,P_PRICE FROM PRODUCT WHERE P_CODE='11QER/31'); A) True B) False
- Write a SQL statement to get the list of all the law firms from thedatabase in alphabetical order by firm name. Include all thecolumns from the LawFirm table.Write a SQL statement to get the list of all the law firms with aname that contains the letter Z. Include all fields from the LawFirmtable.Write a SQL statement to get the list of all the lawyers, showingonly the name and surname of the lawyer, and the name of theirfirm. What is the difference between the WHERE and HAVING clauses in SQLstatements? What is the purpose of an index in a SQL database?9.use the data which is given as shown bwlow to Write a SQL statement to display the most expensive and the cheapest product (list price). Display product ID, product name, and the list price.Write the following SQL Statements:1. Write a SELECT statement that returns one row for each customer that has orders with these columns:->The email_address from the Customers table->A count of the number of orders->The total amount for each order (Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.)->Return only those rows where the customer has more than 1 order.->Sort the result set in descending sequence by the sum of the line item amounts. Q2 7. Write a SELECT statement that returns the name and discount percent of each product that has a unique discount percent. In other words, don’t include products that have the same discount percent as another product.
- 10.use sql to Write a SQL query from the following data (as shown below)to display the number of customers with total order amount over the average amount of all orders,the number of customers with total order amount under the average amount of all orders,number of customers with no orders, and the total number of customersa. Write a sql query to find the number of flights in each month sorted in descending order. It should show the month name and the total number of flights for that month. Show the query and the result.b. Write a sql query to find the month that has the longest total delays. The answer should show the month and the total length of delays in minutes.c. Write a sql query to find the month that has the most frequent delays for each airline. The answer should show the airline code, the month, and the number of delays. Show the first 20 airlines.d. Write a sql query to find the top ten most frequent flights from the dataset. The answer should show the airline code, the departing airport, the arriving airport, and the number of flights.Write SQL statement to perform the following : A)Display these three columns ( FIRST_NAME , LAST_NAME , HIRE_DATE ) . B) Describe EMPLOYEES Table. C) List all customers from CUSTOMERS table .
- Write the following SQL Statements: Write a SELECT statement that returns one row for each customer that has orders with these columns: The email_address from the Customers table A count of the number of orders The total amount for each order (Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.) Return only those rows where the customer has more than 1 order. Sort the result set in descending sequence by the sum of the line item amounts. Write a SELECT statement that answers this question: What is the total amount ordered for each product? Return these columns: The product name from the Products table The total amount for each product in the Order_Items (Hint: You can calculate the total amount by subtracting the discount amount from the item price and then multiplying it by the quantity) Use the ROLLUP operator to include a row that gives the grand total. Write a SELECT statement that answers this question: Which customers have ordered more…Create a function name BALANCE that returns the status of outstanding amount for each customer. Use the following criteria for your function: Outstanding_amt less than 5000 , returns ‘SMALL AMOUNT’ Outstanding_amt between 5000 and 10000 , returns ‘AVERAGE AMOUNT’ Outstanding_amt greater than 10000 , returns ‘LARGE AMOUNT’ Use function BALANCE in your SQL statements that display the cust_code, cust_name, Outstanding_amt and function BALANCE.Given the following SQL statement, which statement is most accurate?SELECT customer# FROM customersJOIN orders USING(customer#)WHERE shipdate-orderdate IN(SELECT MAX(shipdate-orderdate) FROM ordersWHERE shipdate IS NULL);a. The SELECT statement fails and returns an Oracle error message.b. The outer query displays no rows in its results because the subquery passes a NULLvalue to the outer query.c. The customer number is displayed for customers whose orders haven’t yet shipped.d. The customer numbers of all customers who haven’t placed an order are displayed