Question

Database Queries Use the file at the bottom of this assignment to complete the following: Create...

Database Queries

Use the file at the bottom of this assignment to complete the following:

  1. Create a query that shows all customers with account balances less than $18,000. Sort ascending by the date the account was open.
  2. Create a query that shows all customers from Durham with Savings accounts. Sort ascending by the last name of the customer.
  3. Create a query that shows all customers from Raleigh who opened their accounts before 1998. Sort descending by account type.
  4. Create a query that shows all customers from Cary and Garner with a savings account.
  5. Create a query that shows all customers in Raleigh and Durham with checking account balances greater $13,000. Sort ascending by account balance.
  6. I need help with the proper syntax in access to create these queries.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note : You need to install mysql in your system or test in any mysql online ide.

Create database with name 'bank' :

CREATE DATABSE bank;

Check where database is create or not :

SHOW DATABASES;

Use 'bank' database :

USE bank;

Create table with name 'accounts' to insert data & for query :

CREATE TABLE accounts(
ACCOUNT_NUMBER INT(11) NOT NULL PRIMARY KEY,
CUSTOMER_FIRST_NAME CHAR(30),
CUSTOMER_LAST_NAME CHAR(30),
ACCOUNT_BALANCE INT(20),
ACCOUNT_TYPE CHAR(15),
CUSTOMER_CITY CHAR(30),
ACCOUNT_OPENING_DATE, DATE
);

Insert datas into the table 'accounts' :

INSERT INTO accounts
(ACCOUNT_NUMBER, CUSTOMER_FIRST_NAME, CUSTOMER_LAST_NAME, ACCOUNT_BALANCE,
ACCOUNT_TYPE,CUSTOMER_CITY, ACCOUNT_OPENING_DATE) VALUES
       (10000000001, 'Ranveer', 'Napoor', 10000, 'Saving', 'Aberdeen', '1994-02-27'),
       (10000000002, 'Sunil', 'Keshri', 18000, 'Current', 'Bangor', '1995-03-31'),
       (10000000003, 'Rohit', 'Kumar', 25000, 'Current', 'Bath', '1996-05-14'),
       (10000000004, 'Anmol', 'Singh', 50000, 'Saving', 'Durhan', '1997-07-16'),
       (10000000005, 'Avery', 'Aiden', 15000, 'Saving', 'Bradford', '1998-11-21'),
       (10000000006, 'Elia', 'Jackson', 27000, 'Current', 'Cambridge', '1999-04-14'),
       (10000000007, 'Grace', 'Samuel', 75000, 'Saving', 'Carlisle', '2000-05-16'),
       (10000000008, 'Lilly', 'John', 5000, 'Saving', 'Cary', '2005-08-23');
       (10000000009, 'Zoey', 'Anthony', 13000, 'Current', 'Garner', '2007-08-20'),
       (10000000010, 'Harper', 'Joseph', 200000, 'Saving', 'Raleigh', '2009-12-31');

Queries on table :

1) Create a query that shows all customers with account balances less than $18,000. Sort ascending by the date the account was open.

SELECT *
FROM accounts
WHERE ACCOUNT_BALANCE < 18000
ORDER BY ACCOUNT_OPENING_DATE ASC;

2) Create a query that shows all customers from Durham with Savings accounts. Sort ascending by the last name of the customer.

SELECT *
FROM accounts
WHERE CUSTOMER_CITY = 'Durhan' AND ACCOUNT_TYPE = 'Saving'
ORDER BY CUSTOMER_LAST_NAME ASC;

3) Create a query that shows all customers from Raleigh who opened their accounts before 1998. Sort descending by account type.

SELECT *
FROM accounts
WHERE CUSTOMER_CITY = 'Raleigh' AND YEAR(ACCOUNT_OPENING_DATE) = 1998
ORDER BY ACCOUNT_TYPE ASC;

4) Create a query that shows all customers from Cary and Garner with a savings account.

SELECT *
FROM accounts
WHERE ACCOUNT_TYPE = 'Saving' AND (CUSTOMER_CITY = 'Cary' AND CUSTOMER_CITY = 'Garner');

5) Create a query that shows all customers in Raleigh and Durham with checking account balances greater $13,000. Sort ascending by account balance.

SELECT *
FROM accounts
WHERE ACCOUNT_BALANCE > 13000 AND (CUSTOMER_CITY = 'Raleigh' AND CUSTOMER_CITY = 'Durhan');

Please upvote if it helps. Feel free to comment if you have any query.

***thank you***

Add a comment
Know the answer?
Add Answer to:
Database Queries Use the file at the bottom of this assignment to complete the following: Create...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider EMPLOYEE database. Create the database and run the following queries and write the result you...

    Consider EMPLOYEE database. Create the database and run the following queries and write the result you get. What would be the result of the following query (please create the resulting table will all the columns and rows)? SELECT                      D.Dname, E.Lname, P.Pname FROM                         DEPARTMENT D, EMPLOYEE E, WORKS_ON W, PROJECT P WHERE                      D.Dnumber=E.Dno AND E.Ssn=W.Essn AND W.Pno=P.Pnumber ORDER BY                 D.Dname DESC, E.Lname DESC;

  • SQL Queries – in this assignment you will be asked to create several SQL queries relating...

    SQL Queries – in this assignment you will be asked to create several SQL queries relating to the Sakila database that we installed in class. You may freely use DBeaver to create these queries, but I will expect your solution to show me the SQL code to answer or complete the tasks below. Write a query that produces the last name, first name, address, district, and phone number for every customer in the customer table. (You don’t need to include...

  • You must use the Access database and create queries that will answer the requests below. You...

    You must use the Access database and create queries that will answer the requests below. You may use direct SQL to create the queries. Store them using the number of the question (Q1, Q2, etc.). Question: Obtain the average price before discount of all books that were delivered after May 5, 2016. We're not using Join or Join In functions. Just SELECT, FROM, WHERE, ORDER BY, and SORT BY Thanks! Book Wrote Author Authorid AuthornD FrstName nitials Category AuthorRank OrderLine...

  • Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587...

    Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587 When all of your queries are complete, cut and paste the SQL Syntax into a word document. In order to see what the column names are, you need to click on the table and then Columns to see the field names. Make sure to include column headings that make sense in the queries (use the as “Field Name” after the field selected). Multi-table Queries...

  • In using a database created from this model, which of the following SQL queries would give...

    In using a database created from this model, which of the following SQL queries would give us a list of customers who have daily deposit transactions (deposit is a transaction type) totaling $10,000 or more across all of their accounts (i.e., this is a total across all accounts of a customer, not per account). Include in this list the Customer ID and name, and the dates and their respective daily total. SELECT c.cust_id, c.cust_name, DATE(t.tran_date), SUM(t.tran_amount) AS daily_total FROM Customers...

  • database access im asked to create two tables; one called employees and one called products. im...

    database access im asked to create two tables; one called employees and one called products. im then asked to enter the info in the picture below into the products table. im then asked to create queries and im not quite sure how to do some of them. any help would be appreciated SerialNo Manufacturer 242XG1 Micron 242XG2 Micron 295XT4 Micron 295XT5 Micron 295XT6 Micron 295XT7 Micron 300RZ2 Micron 300RZ3 Micron 300RZ4 Micron 388MQS1 Compaq 388MQS2 Compaq 388MQS3 Compaq 388MQS4 Compaq...

  • Should be in C# Create an inheritance hierarchy that a bank might use to represent customers’...

    Should be in C# Create an inheritance hierarchy that a bank might use to represent customers’ bank accounts. All customers at this back can deposit (i.e. credit) money into their accounts and withdraw (i.e. debit) money from their accounts. More specific types of accounts also exist. Savings accounts, for instance, earn interest on the money they hold. Checking accounts, on the other hand, charge a fee per transaction. Create base class Account and derived classes SavingsAccount and CheckingAccount that inherit...

  • Java project: A Bank Transaction System For A Regional Bank User Story A regional rural bank...

    Java project: A Bank Transaction System For A Regional Bank User Story A regional rural bank CEO wants to modernize banking experience for his customers by providing a computer solution for them to post the bank transactions in their savings and checking accounts from the comfort of their home. He has a vision of a system, which begins by displaying the starting balances for checking and savings account for a customer. The application first prompts the user to enter the...

  • I am working on multi-table queries for my SQL class using a premade database, which I...

    I am working on multi-table queries for my SQL class using a premade database, which I have included screenshots of. I received assistance and was able to complete a good number of the queries but the bolded ones seem absolutely impossible to do?? How do I write a query for the bolded questions?? I've scoured my textbook and notes and cannot get anything I try to successfully produce results. 1. List all current reservations with the trip ID, customer’s first...

  • Using mySQL, tables at the end... This assignment uses the tables from the vets database. The goa...

    Using mySQL, tables at the end... This assignment uses the tables from the vets database. The goal of the assignment is to get you to think about joins- inner join and outer joins.  If you do a join, where you have the names of two or more tables in the From clause, then you must use the condition join syntax or the column name join. Take care that you do not accidentally do a Cartesian product. If your result set...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT