Knowee
Questions
Features
Study Tools

Write a query to display the number of travel cards having balance less than 45 from travel_card table. Give an alias name as min_balance_count.Note:1. Display only the number of travel cards having balance less than 45 from travel_card table.2. Specify the alias name without any mistake.3. Specify condition on balance column of travel_card table.4. Compare your executed result with the sample output given below.Sample output:

Question

Write a query to display the number of travel cards having balance less than 45 from travel_card table. Give an alias name as min_balance_count.Note:1. Display only the number of travel cards having balance less than 45 from travel_card table.2. Specify the alias name without any mistake.3. Specify condition on balance column of travel_card table.4. Compare your executed result with the sample output given below.Sample output:

...expand
🧐 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 desired output:

SELECT COUNT(*) AS min_balance_count
FROM travel_card
WHERE balance < 45;

Let's break it down:

  1. SELECT COUNT(*) AS min_balance_count: This part of the query is used to count the number of rows returned by the query. The AS keyword is used to give the count an alias name, min_balance_count.

  2. FROM travel_card: This part of the query specifies the table we are selecting data from, which is the travel_card table.

  3. WHERE balance < 45: This is the condition that the rows must meet in order to be included in the count. In this case, we are only counting rows where the balance is less than 45.

This problem has been solved

Similar Questions

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:

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 number of bills having fine_amount. Give an alias name as 'count_of_bills_with_fine'.Note:1. Display only the number of bills having the fine_amount from bill table. (If fine_amount is greater than 0 then it indicates that bill got fine_amount.)2. Specify the alias name without any mistake.3. Specify condition on fine_amount column of bill table.3. Compare your executed result with the sample output given below.Sample output:

Write a query to display the minimum fine_amount present in the bill table. Give an alias name to the minimum fine_amount as 'min_fine_amount'.Note:1. Display only the minimum 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 person_name and the contact_number from travel_card table of every person whose destination station is on the route 'North East line' with the payment more than 25. Display the records in ascending order based on person name.Note:1. Display only the person_name and contact_number from the travel_card table whose travel_payment destination route North East line with amount >25.2. Tables involved are travel_card, travel_payment and station3. In travel_payment table, the exit_station_id must match with the station id with name ‘North East line’ and amount greater than 25.4. Order by is mandatory.5. 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.