Knowee
Questions
Features
Study Tools

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.

Question

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.

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

Solution

Here is the SQL query you need to write to get the sum of amount from the travel_payment table and give it an alias name as total_payment:

SELECT SUM(amount) AS total_payment 
FROM travel_payment;

This query works as follows:

  1. SELECT SUM(amount): This part of the query is used to calculate the sum of the 'amount' column in the table.

  2. AS total_payment: This part of the query is used to give an alias name to the sum of the 'amount'. Here, the alias name given is 'total_payment'.

  3. FROM travel_payment;: This part of the query specifies from which table the data should be selected. Here, the data is selected from the 'travel_payment' table.

After executing this query, you will get the total sum of the 'amount' column from the 'travel_payment' table, and it will be displayed with the alias name 'total_payment'.

This problem has been solved

Similar Questions

Write a query to display the sum of payable_amount and fine_amount of all the bills from bill table. Give an alias name to the sum of payable amount and fine amount as 'sum_payable_and_fine_amount'.Note:1. Display only the sum of payable_amount and fine_amount from bill table.2. Specify the alias name without any mistake.3. Compare your executed result with the sample output given below.Sample output:

Write a query to display the sum of payable_amount with due_date '2017-10-01' from bill table. Give an alias name to the sum of payable amount as 'sum_payable_amount'.Note:1. Display only the sum of payable_amount with the given due_date from bill table.2. Specify the alias name without any mistake.3. Specify the condition and retrieve the correct rows in the result(condition need to be specified on due_date).4. Compare your executed result with the sample output given below.Sample output:

Write a query to display the sum of payable_amount of all the bills from bill table.Give an alias name to the sum of payable amount as 'sum_payable_amount'.Note:1. Display the sum of payable_amount from bill.2. Specify the alias name without any mistake.3. Compare your executed result with the sample output given below.Sample output: SubmitSaveExecutePrevious Submission

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.

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.

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.