Databases | SQL | Oracle | MS Access Answers

Questions: 901

Answers by our Experts: 732

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

What is the importance of automata theory? Where it can be applied? What is the basic unit of language? Show the examples


Draw DFAs for the regular expression R= a ∗ (ba∗ ba∗ ) ∗




Fetch the top 10 videos having more number of views, along with the channel details.

Note:

Sort the output in the descending order of no_of_views, and then in the ascending order of channel_name.

Expected Output Format:

video_nameno_of_viewschannel_name

TABLE CHANNEL:-

       channel_id	    name	      owner_id	created_datetime
          350	    Motivation grid	    1011	2014-10-05 17:32
          351	      Marvel	        1011	2014-10-05 17:32
          352	      Disney	        1012	2015-09-10 15:32
          353	       Tedx	            1013	2016-10-05 17:32
          354	       ETV	            1011	2012-08-17 19:32
          355	       Maa	            1012	2007-03-07 11:32
          356       PewDiePie	        1012	2004-10-05 11:32
          357	   VanossGaming	        1013	2005-09-10 15:32
          358	    Markiplier	        1013	2014-10-05 08:32
          359	      Ninja	            1012	2016-08-17 17:32
          360	      WWE	            1011	2016-09-10 12:32
          361	   Tech savvy	        1011	2016-09-10 12:32
          362	  Marques Brownlee.	    1012	2018-09-10 12:32
          363	    The Verge	        1013	2015-09-10 12:32

TABLE VIDEO:-

video_id	name	duration_in_secs	published_datetime	no_of_views	channel_id
1000	 Getting My 
     Driver's License      3652	          2011-12-05 19:00	    10619	   367
     | Lele Pons	      
1001	Apple iPhone 
     X Review: The         4556	          2021-01-19 20:12	    140012	   362
        Best Yet!	       
1002	Victoria Beckham
       Gives Strangers 
       Fashion Advice for   836	          2021-01-19 20:12	     75609	    353
     $2 in Central Park 
      | Vanity Fair	
1003	4 Reasons I Don't
      Like Thanksgiving     1751	      2017-05-05 17:32	    279351	    350
        || Mayim Bialik	
1004	Maroon 5 - What
          Lovers Do         3186	      2018-02-17 19:32	     94945	    354
       (Live On The Ellen 
      DeGeneres Show/2017)	
1005	Alicia Keys - When
       You Were Gone	    3737	      2018-04-10 12:32	     35526	    361
1006	U.S. Navy Three 
      Carrier Formation in  3538	      2021-01-19 20:12	     180973	    362
      Western Pacific Ocean	
1007	DIY - Simon's Cat  
     | NEW BLACK & WHITE!	1365	      2012-09-07 11:32	     106271	    355
1008  You, but in emojis. 
         (YIAY #375)	    3874	      2021-01-19 20:12	     16469	    352
1009	100 People Hold 
       Their Breath for as 
         Long as They Can	 2885	      2015-05-17 19:32	     272102	    354
1010   Luke Bryan - Hooked 
        On It (Audio)	     2106	      2016-02-10 12:32	     184471	    366

EXPECTED OUTPUT:-

video_name	no_of_views	channel_name
    ...	         ...	    ...

Define in detail Variables and their types also define the variables of SQL Server.


This is the code for Getting all the channel_ids that uploaded at least one video in "AI/ML" or "Robotics" technologies between 2018 and 2021.


SELECT

 DISTINCT channel_id

FROM

 video

WHERE

 video_id >= 1

 AND name LIKE '%AI/ML%'

 OR name LIKE '%Robotics%'

 AND strftime('%Y', published_datetime) BETWEEN "2018"

 AND "2021"

GROUP BY

 channel_id

ORDER BY

 channel_id ASC;


Output Table:

channel_id
    351
    353
    364
    365
    377


But,

How can I Get all the channel_ids that uploaded at least 20 videos in "AI/ML", "Cyber Security", "Data Science" or "Robotics" technologies between 2018 and 2021.

Example: If a channel publishes 5 videos in AI/ML, 10 videos in Cyber Security and 5 videos in Data Science, consider the channel


the table data is very huge so, I cant send the complete table data.

please help me.


This is the code for Getting all the channel_ids that uploaded at least one video in "AI/ML" or "Robotics" technologies between 2018 and 2021.


SELECT

 DISTINCT channel_id

FROM

 video

WHERE

 video_id >= 1

 AND name LIKE '%AI/ML%'

 OR name LIKE '%Robotics%'

 AND strftime('%Y', published_datetime) BETWEEN "2018"

 AND "2021"

GROUP BY

 channel_id

ORDER BY

 channel_id ASC;


Output Table:

channel_id
    351
    353
    364
    365
    377


But,

How can I Get all the channel_ids that uploaded at least 20 videos in "AI/ML", "Cyber Security", "Data Science" or "Robotics" technologies between 2018 and 2021.

Example: If a channel publishes 5 videos in AI/ML, 10 videos in Cyber Security and 5 videos in Data Science, consider the channel


the table data is very huge so, I cant send the complete table data.

please help me.




Find the sum of durations of the videos published by each channel in hours.


Note:

  • The output must contain the duration as number of hours.
  • Sort the output in the descending order of the no_of_hours

Table: Video

video_id	name	duration_in_secs	published_datetime	no_of_views	   channelid
1002   Victoria Beckham
        Gives Strangers 
        Fashion Advice      836	         2021-01-19 20:12	    75609	      353
       for $2 in Central 
       Park | Vanity Fair	
	
1007	DIY - Simon's Cat  
       |NEW BLACK & WHITE!	 1365	     2012-09-07 11:32	    106271	      355

1008	You, but in emojis.
        (YIAY #375)	         3874	     2021-01-19 20:12	    16469	      352

1009	100 People Hold 
       Their Breath for as   2885	     2015-05-17 19:32	    272102	      354
       Long as They Can	     

1010	Luke Bryan - Hooked
          On It (Audio)	     2106	     2016-02-10 12:32	    184471	      366

1011	The perfect ice - 
          Ice boats on       2549	     2020-07-10 15:32	    108047	      352
           Lake Geneva	

1012	5 Days Of Wearing 
        DIY Makeup | Try     3172	     2018-11-05 08:32	    178623	      358
       Living With Lucie 
        | Refinery29	

1013	Idiot's Guide to 
      Japanese Squat Toilets  709	     2009-08-05 11:32	    44293	      356

1019	Vostok Brompton Beach 
                Ride	        2022	 2016-04-05 19:00	    204704	      367

1020	SHOPPING FOR NEW FISH!! 3496	 2021-01-19 20:12	    294429	      359

1021	Paramore: Fake Happy 
           [OFFICIAL VIDEO]	    1397	 2015-07-05 19:00	    245138	      368

1022	Howard Stern: George 
      Takei Talks About Harvey 
        Weinstein and Sexually  776	     2021-01-19 20:12	    35875	      360
                Assault	

1023	Tony Hawk Answers 
      Skateboarding Questions   4476	 2017-02-17 19:32	    143404	      354
           From Twitter |
        Tech Support | WIRED	

1024	Kimbra - Top of the 
        World (Official Music   3243	 2015-01-05 19:00	    220673	      368
               Video)	

1025	Aly Raisman On Dr. 
      Larry Nassar’s Medical 
      Treatment: I Didn’t Know  2978	 2014-12-17 19:32	     93272	      354
      It Was Abuse | Megyn Kelly 
             TODAY	

1026	When Someone Has A 
     Crush on You | Lilly Singh	 959	 2021-01-19 20:12	     139481	      360

1051	Demi Lovato - Sorry 
   Not Sorry in the Live Lounge	 3929	 2021-01-19 20:12	     265864	      365




Expected Output Format

  channel_id	no_of_hours
      ...	       ...

Get all the channel_ids that uploaded at least 5 videos in "AI/ML", "Cyber Security", "Data Science" or "Robotics" technologies between 2018 and 2021.

Example: If a channel publishes 2 videos in AI/ML, 1 videos in Cyber Security and 2 videos in Data Science, consider the channel.


Note:

  • Consider all the videos that have any of the technologies mentioned above in their name
  • Sort the output in the ascending order of channel_id.

Table: Video

video_id	name	duration_in_secs	published_datetime	no_of_views	   channelid
1002   Victoria Beckham
        Gives Strangers 
        Fashion Advice      836	         2021-01-19 20:12	    75609	      353
       for $2 in Central 
       Park | Vanity Fair	
	
1007	DIY - Simon's Cat  
       |NEW BLACK & WHITE!	 1365	     2012-09-07 11:32	    106271	      355

1008	You, but in emojis.
        (YIAY #375)	         3874	     2021-01-19 20:12	    16469	      352

1009	100 People Hold 
       Their Breath for as   2885	     2015-05-17 19:32	    272102	      354
       Long as They Can	     

1010	Luke Bryan - Hooked
          On It (Audio)	     2106	     2016-02-10 12:32	    184471	      366

1011	The perfect ice - 
          Ice boats on       2549	     2020-07-10 15:32	    108047	      352
           Lake Geneva	

1012	5 Days Of Wearing 
        DIY Makeup | Try     3172	     2018-11-05 08:32	    178623	      358
       Living With Lucie 
        | Refinery29	

1013	Idiot's Guide to 
      Japanese Squat Toilets  709	     2009-08-05 11:32	    44293	      356

1019	Vostok Brompton Beach 
                Ride	        2022	 2016-04-05 19:00	    204704	      367

1020	SHOPPING FOR NEW FISH!! 3496	 2021-01-19 20:12	    294429	      359

1021	Paramore: Fake Happy 
           [OFFICIAL VIDEO]	    1397	 2015-07-05 19:00	    245138	      368

1022	Howard Stern: George 
      Takei Talks About Harvey 
        Weinstein and Sexually  776	     2021-01-19 20:12	    35875	      360
                Assault	

1023	Tony Hawk Answers 
      Skateboarding Questions   4476	 2017-02-17 19:32	    143404	      354
           From Twitter |
        Tech Support | WIRED	

1024	Kimbra - Top of the 
        World (Official Music   3243	 2015-01-05 19:00	    220673	      368
               Video)	

1025	Aly Raisman On Dr. 
      Larry Nassar’s Medical 
      Treatment: I Didn’t Know  2978	 2014-12-17 19:32	     93272	      354
      It Was Abuse | Megyn Kelly 
             TODAY	

1026	When Someone Has A 
     Crush on You | Lilly Singh	 959	 2021-01-19 20:12	     139481	      360

1051	Demi Lovato - Sorry 
   Not Sorry in the Live Lounge	 3929	 2021-01-19 20:12	     265864	      365




Expected Output Format

 channel_id
     ...
Get the distinct ids of videos that belong to the following genres.

genre_id	genre
201	        Comedy
202	        Action
203	        Thriller
211	         Scifi
Note:
Sort the output in the descending order of
video_id
Expected Output Format
video_id
...
genre_id genre_type
201       ACTION 
202       COMEDY
203       THRILLER
204       ROMANTIC
205        TECHNICAL
206       HEALTH CARE
207       GAMING
208       MUSIC VIDEOS
209       TEASER
210        INSPIRATIONAL
211       SCI-FI

Get all the channel_ids that uploaded at least 5 videos in "AI/ML", "Cyber Security", "Data Science" or "Robotics" technologies between 2018 and 2021.

Example: If a channel publishes 2 videos in AI/ML, 1 videos in Cyber Security and 2 videos in Data Science, consider the channel.

Note:

  • Consider all the videos that have any of the technologies mentioned above in their name
  • Sort the output in the ascending order of channel_id.

Table: Video

video_id	name	duration_in_secs	published_datetime	no_of_views	   channelid
1002   Victoria Beckham
        Gives Strangers 
        Fashion Advice      836	         2021-01-19 20:12	    75609	      353
       for $2 in Central 
       Park | Vanity Fair	
	
1007	DIY - Simon's Cat  
       |NEW BLACK & WHITE!	 1365	     2012-09-07 11:32	    106271	      355

1008	You, but in emojis.
        (YIAY #375)	         3874	     2021-01-19 20:12	    16469	      352

1009	100 People Hold 
       Their Breath for as   2885	     2015-05-17 19:32	    272102	      354
       Long as They Can	     

1010	Luke Bryan - Hooked
          On It (Audio)	     2106	     2016-02-10 12:32	    184471	      366

1011	The perfect ice - 
          Ice boats on       2549	     2020-07-10 15:32	    108047	      352
           Lake Geneva	

1012	5 Days Of Wearing 
        DIY Makeup | Try     3172	     2018-11-05 08:32	    178623	      358
       Living With Lucie 
        | Refinery29	

1013	Idiot's Guide to 
      Japanese Squat Toilets  709	     2009-08-05 11:32	    44293	      356

1019	Vostok Brompton Beach 
                Ride	        2022	 2016-04-05 19:00	    204704	      367

1020	SHOPPING FOR NEW FISH!! 3496	 2021-01-19 20:12	    294429	      359

1021	Paramore: Fake Happy 
           [OFFICIAL VIDEO]	    1397	 2015-07-05 19:00	    245138	      368

1022	Howard Stern: George 
      Takei Talks About Harvey 
        Weinstein and Sexually  776	     2021-01-19 20:12	    35875	      360
                Assault	

1023	Tony Hawk Answers 
      Skateboarding Questions   4476	 2017-02-17 19:32	    143404	      354
           From Twitter |
        Tech Support | WIRED	

1024	Kimbra - Top of the 
        World (Official Music   3243	 2015-01-05 19:00	    220673	      368
               Video)	

1025	Aly Raisman On Dr. 
      Larry Nassar’s Medical 
      Treatment: I Didn’t Know  2978	 2014-12-17 19:32	     93272	      354
      It Was Abuse | Megyn Kelly 
             TODAY	

1026	When Someone Has A 
     Crush on You | Lilly Singh	 959	 2021-01-19 20:12	     139481	      360

1051	Demi Lovato - Sorry 
   Not Sorry in the Live Lounge	 3929	 2021-01-19 20:12	     265864	      365



Expected Output Format

 channel_id
     ...
LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS