Knowee
Questions
Features
Study Tools

Write a query to display details of the train_arrival_time which does not have any deviation.Display the records in ascending order based on the metro_train_id.

Question

Write a query to display details of the train_arrival_time which does not have any deviation.Display the records in ascending order based on the metro_train_id.

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

Solution

Sure, here is a SQL query that should give you the desired result:

SELECT * 
FROM train_arrival_time 
WHERE deviation IS NULL 
ORDER BY metro_train_id ASC;

Here's a step-by-step breakdown of the query:

  1. SELECT * FROM train_arrival_time: This part of the query selects all columns from the train_arrival_time table.

  2. WHERE deviation IS NULL: This is the condition that filters the records. It only includes the records where the deviation column is NULL, which means there is no deviation.

  3. ORDER BY metro_train_id ASC: This part of the query sorts the result in ascending order based on the metro_train_id column. If you want to sort the results in descending order, you can replace ASC with DESC.

This problem has been solved

Similar Questions

Create a view named 'train_details_with_deviation' to display the metro train id,position and updated time of all the trains having deviation.

Create a view named 'train_details_with_deviation' to display the metro train id,position and updated time of all the trains having deviation.Note:1. Do not change the name of the view2. Include only 3 columns,  id, position and updated_time from metro_train table whose train_arrival_time got deviation.3. Use subquery. Tables involved are metro_train and train_arrival_time.4. Submit only the CREATE VIEW query.Instructions:1. Create the view successfully2. Once the view is created, check the correctness of the virtual table by displaying all the records in it.3. DO NOT submit the select query. Submit only the CREATE VIEW query.

Write a query to display all details of the station whose name starts with the letter 'K'. Display the records in ascending order based on the name.Note:1. Display all the columns present in the station table.2. Specify the condition and retrieve the correct rows in the result(condition need to be specified on name column).3. You can compare your executed result with the sample output given below.4. Order by is mandatorySample output:

Write a query to display person name,contact number and balance  of all the details, who are travelled maximum number of times. If there is multiple record dipsplay the record in descending order by person name.Note:1. Display only the  peron name, contact number and balance whose travelled maximum number of times.2. Order by is mandatory.3. 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]

1/2

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.