Question

1) Write SQL to return the first and last name of all actors with a first...

1) Write SQL to return the first and last name of all actors with a first name of "ADAM" (use the ACTOR table) who have: (a) an ID of 11, 16, or greater than or equal to 70 AND (b) a last name that starts with the letter H or higher (I, J, K, etc.)

2) Write SQL with the LIKE operator to return addresses that are in the "Dhaka" district and have street addresses that do not contain the character sequence "Loop". You can return attributes (columns) values from the ADDRESS table for rows that matches this criteria.

3) Write SQL with the BETWEEN and ORDER BY clause to return the payments in descending order (i.e., highest payments first) from the PAYMENT table for customer IDs between 300 and 400. You can return all columns in the table.

4) Write SQL with the IN operator to return a concatenation of film title and description from the FILM table that have a replacement cost of either 10.99, 23.99, or 21.99 or have a description that contains the character sequence "Drama". Do NOT use the OR operator more than once in your solution.Your result should contain a single column and start like the following (HINT: you will need to use the CONCAT function)

ALABAMA DEVIL: A Thoughtful panorama of a database adm.....

ALI FOREVER: A Action-Packed Drama of a Dentist and a cro....

5) Write SQL with logical operators to return all information about payments in the PAYMENT table that were either (a) more than $3 and less or equal to than $8 OR (b) round to $1 (HINT: use the ROUND function). You should only return the first 10 of these rows, as ordered by the payment amount.

Homework Answers

Answer #1

1.

a. select firstname, lastname from Actor where firstname = 'ADAM' and (id in (11,16) or id >= 70)

b. select firstname, lastname from Actor where firstname = 'ADAM' and lastname like '[H-Z]%'

3. select * from Payment where customer_ids between (300,400) order by payments desc

4. select concat(f.title, ': ' ,f.description) as FilmDescription from Film as f where replacement_cost in (10.99,23.99,21.99) or description like '%Drama%'

5. select * from Payment where (payments > 3 and payments <= 8) or round(payments) = 1

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write code in SQL. Q1) By looking at city table. Write a query that identify the...
Write code in SQL. Q1) By looking at city table. Write a query that identify the in how many cities the company has branches. Rename the column name to TotalNumberOfCities. You have to look at city table and write a query to count number of rows. Q2) By looking at film table. How many films we have that its description contains the word "Robot". Count number of films and rename the column to NumberofRobots Q3) By looking at film table....
Suppose all the employees got promoted on January 1, 2000. Write an SQL query that will...
Suppose all the employees got promoted on January 1, 2000. Write an SQL query that will output first name, last name, salary, department and date (in a specific format) columns from the Employees table. The first column will be the employee’s first name, the second column will be the employee’s last name, the third column will be the current salary and the fourth column will show the 'Updated salary' of the employees. The updated salary column will be calculated as...
Open the World database on MySQL. Write the SQL code to display the name and population...
Open the World database on MySQL. Write the SQL code to display the name and population of all cities that meet two conditions: a.) the city has a population more than 100,000; and b.) the city name has (anywhere) the letter a followed by any character followed by the letter z. Use a regular expression for the second condition. Sequence the query results in descending order by population. What is the city with the largest population in the output?
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL...
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL CPTR HIST MATH RELB Data Type Text Text Text Text Text Number Currency Date/Time Text DEPT_TITLE Biology Computer Science History Mathematics Religion    Field Name DEPT_CODE DEPT_TITLE Data Type Text Text INSTRUCTIONS Use SQL commands to create the tables and enter the data shown above using MS Access. Write the following SQL statement given below: 1. 2. 3. 4. 5. 6. 7. 8. 9....
Write a SQL statement which joins the parts table with the supplier table and lists the...
Write a SQL statement which joins the parts table with the supplier table and lists the part_name, supplier_name for all parts in the part table. The supplier_id column in the suppliers table is the primary key in the suppliers table, and this key has been exported to the parts table where it is a foreign key. You should use an inner join for this query. Write a SQL statement which joins the parts table with the suppliers table and lists...
3. How many people have the last name King Use PL/SQL? Code: Output: 4. Change the...
3. How many people have the last name King Use PL/SQL? Code: Output: 4. Change the first name to Stephen for the person with the last name King Use PL/SQL. Code: Output: Copy the record showing name change: Code: Output: 5. Delete all employees in Department 20. Use %TYPE for the variable. Use SQL%ROWCOUNT to see how many records were deleted. Code: Copy output showing ROWCOUNT: 6. Use a merge to merge the original employees table into emp_test. Do UPDATE...
I'm really struggling with these homework questions it's mainly 1 and 2, so if you can't...
I'm really struggling with these homework questions it's mainly 1 and 2, so if you can't help with all then please just one and two I've spent hours on those two and can't seem to get past them. SQL That being said, if you could help with these 5 I would very much appreciate it: INVOICES(table) Columns INVOICE_ID VENDOR_ID INVOICE_NUMBER INVOICE_DATE INVOICE_TOTAL PAYMENT_TOTAL CREDIT_TOTAL TERMS_ID INVOICE_DUE_DATE PAYMENT_DATE VENDORS(table) Columns VENDOR_ID VENDOR_NAME VENDOR_ADDRESS1 VENDOR_ADDRESS2 VENDOR_CITY VENDOR_STATE VENDOR_ZIP_CODE VENDOR_PHONE DEFAULT_TERMS_ID DEFAULT_ACCOUNT_NUMBER GENERAL_LEDGER_ACCOUNTS(table)...
Class-In Assignment 3: Chapters 4&5 How to retrieve data from two or more tables Exercises 1....
Class-In Assignment 3: Chapters 4&5 How to retrieve data from two or more tables Exercises 1. Write a SELECT statement that returns all columns from the Vendors table inner-joined with all columns from the Invoices table. 2. Write a SELECT statement that returns four columns: vendor_name vendor_name from the Vendors table invoice_number invoice_number from the Invoices table invoice_date invoice_date from the Invoices table balance_due invoice_total minus payment_total minus credit_total from the Invoices table The result set should have one row...
Save your select statements as a script. Place the semicolon at the end of each SQL...
Save your select statements as a script. Place the semicolon at the end of each SQL statement. Please number your select statements from 1 to 8 in your script and comment out each number. Include your name and student number as a comment at the top of your script. The name of the script has to be Assignment1_JohnSmith. Instead of JohnSmith use your First Name and Last Name. Upload your script trough Blackboard. Use SQL Developer to create the My...
Part 1 Write a program that reads a line of input and display the characters between...
Part 1 Write a program that reads a line of input and display the characters between the first two '*' characters. If no two '*' occur, the program should display a message about not finding two * characters. For example, if the user enters: 1abc*D2Efg_#!*345Higkl*mn+op*qr the program should display the following: D2Efg_#! 1) Name your program stars.c. 2) Assume input is no more than 1000 characters. 3) String library functions are NOT allowed in this program. 4) To read a...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT