1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alexeev081 [22]
3 years ago
7

There was a robbery from the ATM at the bank where you work. Some unauthorized withdrawals were made, and you need to help your

bank find out more about those withdrawals. But the only information you have is that there were more than 1 withdrawals and that all of them were done in 10-second gaps.
You have a table customer_transactions with the following columns:
id - the unique transaction ID;
customer_name - the name of the customer of the bank;
transaction_time - the date and time when this transaction was made;
transaction_amount - the amount of money involved in this transaction.
You need to retrieve all the customer_names whose any two consecutive transactions have a 10-second gap from each other. It is guaranteed that no two people have the same name, so equal customer_names correspond to the same person.
Example
For given table customer_transactions
id customer_name transaction_time transaction_amount
1 Lillian Nelson 2017-01-01 10:10:15 10
2 Susan Moore 2017-01-01 11:11:11 20
3 Kian Lawrence 2017-01-01 12:12:12 10
4 Lillian Nelson 2017-01-01 10:10:20 30
5 Lillian Nelson 2017-01-01 10:10:30 40
6 Susan Moore 2017-01-01 11:11:21 50
the output should be
customer_name
Susan Moore
Explanation of the example:
Let's consider all customers:
Lillian Nelson did three transactions at 2017-01-01 10:10:15, 2017-01-01 10:10:20, and 2017-01-01 10:10:30, so the gaps between her transactions are 5 and 10 seconds respectively. Since not all the gaps are 10 seconds long, she cannot be a robber.
Susan Moore did two transactions at 2017-01-01 11:11:11 and 2017-01-01 11:11:21, so the gap between her transactions is 10 seconds. Since all the gaps are 10 seconds long, she possibly can be a robber.
Kian Lawrence did only one transaction, so he cannot be a robber.
Computers and Technology
1 answer:
larisa [96]3 years ago
7 0

Following are the SQL query commands to the given question:

Query:

select customer_name /*using inner select query  */

from

(

/* select column names*/

 SELECT  customer_name,

       transaction_time,

       next_transaction_time,

       TIME_TO_SEC(TIMEDIFF(next_transaction_time, transaction_time)) as difference

FROM    (   SELECT  customer_name,

                   transaction_time,

                   (   SELECT  MIN(transaction_time)  

                       FROM    customer_transactions T2

                       WHERE   T2.customer_name = T1.customer_name

                       AND     T2.transaction_time > T1.transaction_time

                   ) AS next_transaction_time

           FROM    customer_transactions T1

       ) AS T

) X

/*Using group by clause with min and max method*/

GROUP BY customer_name HAVING MIN(difference) = 10 and MAX(difference) = 10

Explanation of query:

  • In this question, Subqueries, group by clause, with the max and min method is used which purpose can be defined as follows:
  • It is utilized for returning information which is used to better limit the data to be found in the primary query.
  • It returns no or more rows through one or more tables or views of the database.
  • It organizes rows into groups depending on its values for one or more columns.
  • Grouping is usually utilized to use some kind of aggregate function for every group.
  • The function MIN() returns the lowest value of the column chosen.
  • The function MAX() returns the highest number in the column chosen.

Learn more:

brainly.com/question/1765746

You might be interested in
Most presentation programs allow you to save presentations so they can be viewed online by saving them as ____
Elza [17]

Explanation:

Most presentation programs allow you to save presentations so they can be viewed online by saving them as html

files.

5 0
3 years ago
Read 2 more answers
What are the main features cyber law of Nepal​
muminat

Answer:

What are the provisions of cyber law in Nepal?

Provision of cyber law of NEPAL

It provides legal status to digital signatures and electronic records which in turn are used in electronic banking, shopping and commerce. It provides laws for formation of judicial system that operates only for crimes related to computer (internet and cyber space).

Hope this helps Have a good day

6 0
3 years ago
Follow me on Tik-Tok​
ivanzaharov [21]

Answer:

Sure

Explanation:

5 0
3 years ago
Read 2 more answers
It’s been six months since the disk crash at CSM Tech Publishing, and the owner is breathing a little easier because you install
Semmy [17]

Answer:

Storage Spaces

Explanation:

The feature that would best accommodate his needs would be the Storage Spaces feature that has been implemented in the Windows and Windows Server systems. This feature basically takes various hard drives and combines them together, this ultimately acts as copies of each other which protect the data of each one in the unfortunate case that one of the drives tends to fail. This feature also allows you to add more drives to the existing ones with very minimal effort without restricting configuration. Which would solve the needs that are needed in this scenario.

5 0
4 years ago
MOA115 Medical Records and Insurance
Kay [80]

Based on the information given about the insurance, it should be noted that there's a difference between the covered and charged amount.

<h3>What is an insurance?</h3>

From the complete question, an insurance means a policy where an individual is entitled to financial protection.

In this case, there's a difference between the covered andd charged amount. Also, based on the table, the amount that Yan will be responsible for is 12.17.

Learn more about insurance on:

brainly.com/question/25855858

6 0
2 years ago
Other questions:
  • Security awareness training can reduce the risk of a data breach by what percentage?
    12·1 answer
  • What type of engineer is needed in the following scenario?
    7·2 answers
  • In order to average together values that match two different conditions in different ranges, an Excel user should use the functi
    6·1 answer
  • Which is an unethical use of technology and resources at the workplace?
    13·2 answers
  • A technician wants to consolidate and log specific alerts from network devices into a database so maintenance tasks and potentia
    11·1 answer
  • If you want to present slides to fellow students your coworkers which productivity software should you use to create them
    15·2 answers
  • Q. Which protocol would best serve to authorize users to access directory services?
    8·1 answer
  • PLEASE HELP!!!!
    6·2 answers
  • Write pseudocode for the question below:
    15·1 answer
  • Why is it important for the scrum master to help the team focus on daily and iteration goals\
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!