BOX8 | Regular Expression in SQL

Question

Find the number of people who are from Delhi and have arrived in Patna in the last 7 days

in progress 2
TheDataMonk 4 years 3 Answers 1322 views Grand Master 1

Answers ( 3 )

  1. select count(*) from flights where location = “Delhi” and
    arrival_date between DATE_SUB(CURDATE(), INTERVAL 7 DAY) and
    CURDATE()

  2. select count(*)
    from table
    where (resident_place= ‘Delhi’ and arrival_place = ‘Patna’ ) and (datetime_col >= DATE(NOW()) + INTERVAL -7 DAY and
    datetime_col < DATE(NOW()) + INTERVAL 0 DAY)

  3. select (*) from table where source_loc = ‘Delhi’ and dest_loc=’Patna’ and trunc (arrival_date) between sysdate and (sysdate-7)

Leave an answer

Browse
Browse