Knowee
Questions
Features
Study Tools

Display only the travel_card_id, entry_station_id and sum of amount received between the given entry_time dates from travel_payment table.2. entry_time field is of datatype TIMESTAMP. So the values of entry_time will have both date and time. So here you have truncate the date part alone from the entry_time and then check for the date condition.3. Specify the alias name without any mistake.4. Order by is mandatory5. Compare your executed result with the sample output given below.

Question

Display only the travel_card_id, entry_station_id and sum of amount received between the given entry_time dates from travel_payment table.2. entry_time field is of datatype TIMESTAMP. So the values of entry_time will have both date and time. So here you have truncate the date part alone from the entry_time and then check for the date condition.3. Specify the alias name without any mistake.4. Order by is mandatory5. Compare your executed result with the sample output given below.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

It seems like you're asking for a SQL query to solve this problem. Here's a step-by-step guide on how to do it:

  1. First, you need to select the required columns from the travel_payment table. The SQL command for this would be:
SELECT travel_card_id, entry_station_id
  1. Next, you need to sum the amount received. You can do this using the SUM() function in SQL:
SELECT travel_card_id, entry_station_id, SUM(amount_received)
  1. You want to filter the results based on the entry_time field. Since this field is a TIMESTAMP, you need to truncate the time part and only keep the date. You can do this using the DATE() function:
SELECT travel_card_id, entry_station_id, SUM(amount_received)
FROM travel_payment
WHERE DATE(entry_time) BETWEEN 'start_date' AND 'end_date'

Replace 'start_date' and 'end_date' with the actual dates you want to filter by.

  1. You need to group the results by travel_card_id and entry_station_id to get the sum of amount_received for each combination of these two fields:
SELECT travel_card_id, entry_station_id, SUM(amount_received)
FROM travel_payment
WHERE DATE(entry_time) BETWEEN 'start_date' AND 'end_date'
GROUP BY travel_card_id, entry_station_id
  1. Finally, you need to order the results. The problem statement doesn't specify which column to order by, so let's order by travel_card_id:
SELECT travel_card_id, entry_station_id, SUM(amount_received) AS total_amount
FROM travel_payment
WHERE DATE(entry_time) BETWEEN 'start_date' AND 'end_date'
GROUP BY travel_card_id, entry_station_id
ORDER BY travel_card_id

This query will give you the desired output. Make sure to replace 'start_date' and 'end_date' with the actual dates you want to filter by.

This problem has been solved

Similar Questions

Write a query to display the travel_card_id, entry_station_id and sum of amount received between the entry_time dates 21-Dec-2017 and 23-Dec-2017. Give an alias name as total_payment. Display the records sorted in ascending order based on the travel_card_id.Note:1. Display only the travel_card_id, entry_station_id and sum of amount received between the given entry_time dates from travel_payment table.2. entry_time field is of datatype TIMESTAMP. So the values of entry_time will have both date and time. So here you have truncate the date part alone from the entry_time and then check for the date condition.3. Specify the alias name without any mistake.4. Order by is mandatory5. Compare your executed result with the sample output given below.

Write a query to display travel_card_id, entry_time and exit_time from the travel_payment.Display the records in ascending order based on the entry_time.Note:1. Display only the column named travel_card_id, entry_time and exit_time present in the travel_payment table.2. Order by is mandatorySample output: [Only few records are shown here]

Write a query to display details of the travel_payment whose amount is greater than 30. Display the records in ascending order based on the entry_time.Note:1. Display all the columns present in the travel_payment table.2. Specify the condition and retrieve the correct rows in the result(condition need to be specified on amount column).3. You can compare your executed result with the sample output given below.4. Order by is mandatorySample output: [Only few records are shown here]

Write a query to display  the sum of amount from the travel_payment table. Give an alias name as total_payment.Note:1. Display only the sum of amount from the travel_payment table.2. Specify the alias name without any mistake.3. Compare your executed result with the sample output given below.

Write a query to display the person name,contact number,balance,entry_time and exit_time details of all the persons who is having the second highest balance in their travel cards. Display the records in ascending order based on their person_name.Note:1. Display only the below 5 columns,     i. person name     ii. contact number      iii. balance     iv. entry time and      v. exit timewith the condition having second highest balance.2. Order by is mandatory.3. Compare your executed result with the sample output given below.

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.