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.Sample output:SubmitSaveExecutePrevious Submission
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.Sample output:SubmitSaveExecutePrevious Submission
Solution
The SQL query to display the sum of amount from the travel_payment table with an alias name as total_payment would be:
SELECT SUM(amount) AS total_payment
FROM travel_payment;
Here's how this query works:
-
SELECT SUM(amount): This part of the query is using theSUM()function to add up all the values in theamountcolumn. -
AS total_payment: This part of the query is using theASkeyword to give the result ofSUM(amount)a new name, or alias, which istotal_payment. -
FROM travel_payment;: This part of the query is specifying the table that we are selecting data from, which is thetravel_paymenttable.
After running this query, you should get a single row of output with one column named total_payment, which contains the sum of all values in the amount column from the travel_payment table.
Similar Questions
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 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.
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.
Create a procedure named 'findAmount' which takes 2 input parameters namely, personName is type of varchar2, entryTime is type of timestamp and 1 output parameter namely, travelAmount double precision. This procedure should find the amount for the travel_payment made by the person on time whose personName and entryTime is passed as an input paramter.Hints:Procedure name : findAmountParameters : personName(varchar2),entryTime(timestamp),travelAmount(double precision)Submit
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.