SQL Flashcards

(12 cards)

1
Q

SQL
Insert a new partial record into the customer table using the data;

customer id 1234
customer forename Glenn
Customer surname Newman

A

INSERT INTO customer (customer_ID, forename, surname)

VALUES (“1234”, “Glenn”, “Newman”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

SQL

A list of all customers names who travelled on 1st July 2012 in alphabetical order of surname

A
SELECT forename,surname
FROM customers, journey
WHERE Date_of_journey = #01/07/12
AND customers.customer_ID=Journey.customer_ID
ORDER BY surname;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A list of all customers who travelled from Burnley to Preston ordered by driver

A

SELECT forename, surname
FROM customers, journey
WHERE start_location = “Burnley” AND end_location=”Preston”
AND customers.customer_ID=jouney.customerID
ORDER BY driver_ID;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Insert a new partial record into the customer table using the data; customer id 1234 and the customer’s forename name is Glenn and the customer’s surname is Newman (5 marks)

A

INSERT INTO customers (customer_ID, forename, surname)

VALUES (“1234”, “Glenn”,”Newman”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A list of showing all customers who live in Croston

A

SELECT * (accept any suitable list of fields)
FROM customers
WHERE Town=”Croston”;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

All journeys in reverse date order

A

SELECT *
FROM journey
ORDER BY date_of_ journey DESC;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A list of all Customer details in order of Customer Surname

A

SELECT*
FROM CUSTOMERS
ORDER BY Surname;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A list of Order ids, date and values in order of order date

A

SELECT Order Ids, Order_Date, Order_Value
FROM Orders
ORDER BY Order_Date;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A list of showing all customers who live in Lancashire grouped by Tow

A

SELECT*
FROM CUSTOMERS
WHERE TOWN=“Lancashire”;
GROUP BY Town;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A list of all customers’ names who placed an order on 1st February 2013 in alphabetical order of surname

A
SELECT forename, surname 
FROM CUSTOMERS, Orders
WHERE Order_Date=“#01/02/13”
AND CUSTOMERS.Customer_ID=Orders.Customer_ID
ORDER BY Surname;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A list of all customers who ordered on March 1st 2103 and the value was greater than £100, ordered by salesperson

A

SELECT forename, surename
FROM customers, orders
WHERE Order_Date=“#01/03/2103” AND Order_Value>”£100”
AND customers.customer_id = order.customer_ID
ORDER BY salesperson;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Insert a new partial record into the customer table using the data; customer id 1234 and the customer’s forename name is Paul and the customer’s surname is Smith

A

INSERT INTO CUSTOMER(customer id, customer forename, customer surname)
VALUES (“1234”, “Paul”, “Smith”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly