Write a query to display the variance of balance from the travel_card table. Give an alias name as balance_variance.Note:1. Display only the variance of balance from travel_card table.2. Specify the alias name without any mistake.3. Compare your executed result with the sample output given below.Sample output:
Question
Write a query to display the variance of balance from the travel_card table. Give an alias name as balance_variance.Note:1. Display only the variance of balance from travel_card table.2. Specify the alias name without any mistake.3. Compare your executed result with the sample output given below.Sample output:
Solution
Here is the SQL query you need to write to get the variance of balance from the travel_card table with an alias name as balance_variance:
SELECT VAR(balance) AS balance_variance
FROM travel_card;
Let's break it down:
SELECT: This keyword is used to select data from a database.VAR(balance): This is a function that calculates the variance of the 'balance' column.AS balance_variance: This is an alias that renames the output column as 'balance_variance'.FROM travel_card: This specifies the table from which we are selecting data, in this case, the 'travel_card' table.
After running this query, you will get the variance of the 'balance' column from the 'travel_card' table, and the column name in the result set will be 'balance_variance'.
Similar Questions
Write a query to display the number of travel cards having balance greater than or equal to 45. Give an alias name as max_balance_count.Note:1. Display only the number of travel cards having balance greater than or equal to 45 from travel_card table.2. Specify the alias name without any mistake.3. Specify condition on balance column of travel_card table.3. Compare your executed result with the sample output given below.Sample output:
Write a query to display the variance of the payable_amount whose payment_date is on the month of 'October'. Give an alias name to the variance as 'variance_payable_amount'.Note:1. Display only the variance of payable_amount in the given month from bill table.(only for the month october)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 payment_date column).4. Use variance() to calculate variance.5. Compare your executed result with the sample output given below.Sample output:
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.
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.
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.