Sql date interview questions

Поділитися
Вставка
  • Опубліковано 10 лип 2024
  • In this video we will discuss the common date related sql interview questions and answers. If you are comfortable with the SQL Date functions, then you should be able to easily answer most of these questions.
    Healthy diet is very important for both body and mind. We want to inspire you to cook and eat healthy. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking.
    / @aarvikitchen5572
    Text version of the video
    csharp-video-tutorials.blogsp...
    Slides
    csharp-video-tutorials.blogsp...
    SQL Server Interview Questions and Answers
    • SQL Server Interview Q...
    SQL Server Interview Questions and Answers - Text Articles & Slides
    csharp-video-tutorials.blogspo...
    Angular, JavaScript, jQuery, Dot Net & SQL Playlists
    ua-cam.com/users/kudvenka...
    It is also useful to understand SQL CAST & CONVERT functions. We discussed DATE, CAST & CONVERT functions in Parts 25 to 28 in our SQL Server Tutorial.
    After watching this video you should be able to answer any sql date interview questions similar to the following.
    Write a SQL query to get
    1. All people who are born on a given date (For example, 9th October 2017)
    2. All people who are born between 2 given dates (For example, all people born between Nov 1, 2017 and Dec 31, 2017)
    3. All people who are born on the same day and month excluding the year (For example, 9th October)
    4. All people who are born yesterday, today, tomorrow, last seven days, and next 7 days
    5. All people whose birth year is the same (For example, all people born in 2017, 2018 etc.)
    Once you are comfortable answering these questions you can extend the concepts you have learned to answer similar questions like the following.
    1. Orders placed between 2 given dates or on a given day, month, year etc.
    2. Customers gained or lost.
    3. Employees joined or left etc.
  • Наука та технологія

КОМЕНТАРІ • 48

  • @jack35411
    @jack35411 5 років тому +81

    Can someone urge Indian Government to award Bharat Ratna to Venkat Sir.He is a real teacher.I cannot say how many are placed just because of his videos but there are many who are working in MNC's just because of him.

    • @saktiprasadswain6546
      @saktiprasadswain6546 5 років тому +10

      I want to keep his Pic on my table.But I dont how he looks.He is our real Guru.Whatever I m becoz of him.

    • @mohammednaveed899
      @mohammednaveed899 3 роки тому +2

      100% Agree

    • @jigneshvyas3105
      @jigneshvyas3105 2 роки тому

      lol...but agree....I have immense respect and gratitude for him. I can just tell from his voice that he must be a noble human being.

    • @art-es5lf
      @art-es5lf 2 роки тому +1

      Very True bro i was struggling in sql like hell.....His videos are the greatest on youtube and better than all other platforms..
      now i have gained huge confidence..

  • @saktiprasadswain6546
    @saktiprasadswain6546 5 років тому +1

    This is very very imp video which u needed much long before..Thank u sir ...

  • @NaseerAhmad-ck1vs
    @NaseerAhmad-ck1vs 5 років тому +3

    Thank you sir for helping us
    Your UA-cam channel is the best .

  • @vaibhavvaibhav6118
    @vaibhavvaibhav6118 4 роки тому +1

    You are too good. Everytime I go for an interview I always lookup for your videos.

  • @naazlyhameed8468
    @naazlyhameed8468 5 років тому +3

    May Allah bless you. Plz keep uploading videos

  • @300lazio
    @300lazio 4 роки тому +1

    Thank you, great video as always.

  • @jennylockwood1020
    @jennylockwood1020 4 роки тому

    Thank you Venkat for all your videos :)

  • @quadirnawaz67
    @quadirnawaz67 3 роки тому

    Thank you so much for this SQL tutorial series. You really are awesome

  • @swethaveluguri9115
    @swethaveluguri9115 5 років тому +1

    Great teaching sir. Please add video for difference between ANALYTICAL and AGGREGATE functions in SQL

  • @jaydeepchavda3772
    @jaydeepchavda3772 5 років тому +1

    Thank you sir for preparing such a nice video series. Please make such a nice videos on SSIS and SSRS..

  • @KrishnaBallaviRath
    @KrishnaBallaviRath 4 роки тому

    Thank you so much
    all vedios are based on real time questions...

  • @habtomnigatu5709
    @habtomnigatu5709 5 років тому +3

    I learned a lot from your videos.Thank you so much & Could you please also make a lectures for database administrator.

  • @365DataScience
    @365DataScience 5 років тому +2

    Here are some frequently encountered SQL interview question, and my top tips to answering them:
    1. What is SQL?
    SQL, Structured Query Language, is a programming language designed for working with databases. Some people, however, argue that it is not exactly a programming language since it has not been created with the notion of using features of procedural languages, such as conditional statements or “for” loops. These people insist on calling SQL a coding language because it is only about executing commands for querying, creating, inserting, updating, and deleting data in a database. Nonetheless, the most important thing is to know what the domain of SQL is.
    2. What is a Database? What is a DBMS?
    A database is data stored on a computer and ordered in a way that makes it easy to access and manipulate. a database management system - DBMS is the software tool that allows users to interact with the data stored in the database.
    You could conclude by explaining there are two types of database management systems - relational and non-relational. SQL is a language, designed only for working with relational DBMSs.
    Such questions are usually asked in the beginning of the interview so that you can start preparing for the difficult ones.
    3. What is the difference between DDL, DML, DCL, and TCL?
    First of all, let’s explain what there acronyms stand for:
    “L” stands for “Language” in all of them. And this must help you remember that these are the four categories in which the SQL commands have been separated into.
    DDL stands for Data Definition Language and includes the commands that allow you to CREATE, DROP, ALTER, and TRUNCATE data structures. DML involves commands for manipulating information. It actually means “Data Manipulation Language”, and gives the possibility to SELECT, INSERT, UPDATE, and DELETE data. it is this part of the language you will most use at work, if you are using SQL in the field of data science or business intelligence.
    DCL, Data Control Language, consists of commands that are usually used by database administrators. This one allows programmers to GRANT and REVOKE rights defining how much control you can have over the information in the database.
    Similarly, TCL, which is the Transaction Control Language, also includes the commands applied by database administrators. These command ensures that the danger of suffering from data loss is minimal.
    4. What is the point of using a foreign key constraint?
    The foreign key constraint comprises a set of rules, or limits, that will ensure that the values in the child and parent tables match. Theoretically, the foreign key constraint will maintain the referential integrity within the database.
    5. Define and provide an example of using an inner join.
    Obviously, you must be aware that joins are one of the most frequently used tools in SQL, regardless of your job role. Particularly if you are working in the sphere of business intelligence, your work will be centred around understanding SQL joins in depth.
    So, an SQL join is a tool that allows you to construct a relationship between objects in your database. Consequently, a join shows a result set containing fields derived from two or more tables.
    For instance, assume that in one table you have data about the customer ID and fields related to the sales a customer has made, and in the other, you have data about the customer ID and their private information, such as first and last name and email address. Therefore, an inner join allows you to obtain an output containing information from both tables only for the customer IDs found in the two tables that match. Provided that you set the customer ID field to be a matching column, of course.
    6. What is the difference between MySQL and PostgreSQL? How about between PL/SQL and SQL?
    The interviewers ask these questions as they want to find out how much you are acquainted with the fact that SQL has a few versions, each carrying specific features.
    You could say that MySQL and PostgreSQL are just two versions of the Structured Query Language. Since you’ve just been asked about joins, you could mention that PostgreSQL supports outer joins, while MySQL doesn’t - you’ll need to use UNION or UNION ALL to emulate an outer join in MySQL. This way you could even impress the interviewers with extra knowledge in this subject.
    PL/SQL is not a version of SQL, however, and that’s the tricky part of the question. PL/SQL is a complete procedural programming language and its scope of application is different. It is not strictly related to relational databases.
    7. What is an SQL View?
    Your potential future employers may want to give a toned-down SQL interview question. That’s why they might ask a general question.
    A view is a virtual table whose contents are obtained from an existing table or tables, called base tables. The retrieval happens through an SQL statement, incorporated into the view. In other words, you can think of a view object as a view into the base table. The view itself does not contain any real data; the data is electronically stored in the base table. The view simply shows the data contained in the base table.
    Good luck!
    Source: bit.ly/2Fe6x4Q
    Best,
    365 Data Science
    Online educational career website
    365datascience.com/

    • @MrKoukoo
      @MrKoukoo 4 роки тому

      Thank you!!!., It is helful

  • @darshgupta101
    @darshgupta101 5 років тому +2

    Sir , please also suggest the Oracle counterpart for these solutions to workaround with datetime

  • @AsfakullahLayek
    @AsfakullahLayek 6 місяців тому

    Awesome Explanation

  • @seetharamkothapalli7961
    @seetharamkothapalli7961 5 років тому +2

    could you plz ulpoad emi calaculation in strored procedures with auto-genarated in month or years

  • @anirvansen2941
    @anirvansen2941 4 роки тому

    Really helpful thanks.

  • @sh4rk717
    @sh4rk717 3 роки тому

    Could you make a playlist with all these 16 parts of Q&A? Thank you very much!

  • @adinarayanamamilla2836
    @adinarayanamamilla2836 3 роки тому

    Very nice video for interviews, the way of explanation is awesome. can you please make a video on CASE function please

  • @raqibul1000
    @raqibul1000 5 років тому +1

    ALLAH bless you sir

  • @book_addict.5721
    @book_addict.5721 3 роки тому

    Man, Who u really are.
    because for me you're my database angel.

  • @sams4319
    @sams4319 4 роки тому

    Sir can you post an example for fetching consecutive empty seats....from seats table that has Id seat number and availability columns..input is dynamic like 3 seats or 5 seats...but should be consecutive next to each other...ex bookmyshow app

  • @voletilahari9967
    @voletilahari9967 4 роки тому

    hi Venkat, thanks a lot for the most useful videos, can u please solve this query by tomorrow at least try to comment the code its important.
    1)list out the employee names who purchased at least 5 items on two separate days?

  • @sambitpati6129
    @sambitpati6129 5 років тому

    Sir please make video tutorial for msbi and powerBI if possible

  • @poornaps
    @poornaps 4 роки тому +1

    Hi Sir, just wanted to know how the same day and month fucntion --DAY(DateOfBrith) = 30 And MONTH(DateOfBirth) = 11 will works for postgre sql ?
    postgresql --
    select cast(fc.contact_date as date)as DatePart, fc.contact_channel, count(fc.call_talk_time),
    Round(avg(fc.call_talk_time),2) AS AvgCol, mod(round(avg(call_talk_time),0),60) as modulo
    from ssisdb.fact_contact as fc
    FULL JOIN ssisdb.dim_case_detail as cd
    ON fc.contact_id = cd.contact_id and fc.contact_channel = cd.contact_channel and fc.contact_date = cd.contact_date
    where DAY(fc.contact_date) =06 and Month(fc.contact_date) =11
    group by cast(fc.contact_date as date), fc.contact_channel;

  • @sowmyagirish4155
    @sowmyagirish4155 5 років тому

    Please upload more videos. Thank 🙏💕🙇🙇

  • @mermaidviv4517
    @mermaidviv4517 3 роки тому +1

    I am getting the following error message "Conversion failed when converting the varchar value '2018-11-19 10:36:46.520' to data type int." when creating the table. How do I resolve this?

  • @harshavardhanan.j5057
    @harshavardhanan.j5057 4 роки тому

    Make the conditions dynamic as to get the same birthday without knowing the values in the table

  • @rameshpuli3233
    @rameshpuli3233 5 років тому

    how to retrieve recent hiredate from employee table

  • @babaryaseen389
    @babaryaseen389 3 роки тому

    Thanks Sir

  • @Indian_working_mom
    @Indian_working_mom 4 роки тому

    Please upload sql tutorial some sql server queries are not supported in SQL what to do

  • @javidhesenov7611
    @javidhesenov7611 Рік тому

    thanks

  • @aripakaharshit4752
    @aripakaharshit4752 4 роки тому

    Hi Sir,
    Can you please give us an example of GENDER SWAP(If MALE then FEMALE) using a single line, simple single SQL query?

    • @harinivenkateshan4613
      @harinivenkateshan4613 4 роки тому +1

      update set gender=case when gender = 'male' then 'female' else 'male' end;

  • @ymtan
    @ymtan 5 років тому +1

    Hi Venkat,
    I don't really understand the first parameter of the following DATEADD() function. Could you kindly explain what is the first parameter of the DATEADD() function and why do you specify DAY as the first parameter of the DATEADD() function ???
    DATEADD(DAY, -1, CAST(GETDATE() AS DATE))

    • @Csharp-video-tutorialsBlogspot
      @Csharp-video-tutorialsBlogspot  5 років тому

      To specify the date part to which we want to add -1. In our case we want to add -1 to the day number in the date, so we get yesterday's date. If you want to add -1 to the month number, then you specify the first parameter as month. Please check the following video where we have discussed DATEADD and other Date related functions in detail.
      ua-cam.com/video/eYsizQVa_EU/v-deo.html
      Here is the text articel for the same. Hope this helps.
      csharp-video-tutorials.blogspot.com/2012/09/datepart-dateadd-and-datediff-functions.html

    • @avinash8535
      @avinash8535 3 роки тому

      Dear @@Csharp-video-tutorialsBlogspot Sir, i have a question from my client and I hope only u are the one who can give me the answer... A simple or complex 'Select' query which gives multiple columns data with one column of Id's and another column as varchar(max).. Now my client requested to have the data to be splitted into next line per after every sentence with in a single row.. Tried to find a way but failed and I was able to find CHAR(13) that too will be used only in Print but not select.. Hope i am able to explain the client requirement clearly to u and expecting a response..
      Thanks,
      Avinash

    • @saihuman3840
      @saihuman3840 2 роки тому

      @@avinash8535 hi bro

    • @avinash8535
      @avinash8535 2 роки тому

      @@saihuman3840 yes?

    • @saihuman3840
      @saihuman3840 2 роки тому

      @@avinash8535 bro how can I talk to u

  • @shalinipatel1181
    @shalinipatel1181 2 роки тому +1

    Hi everyone, can you help me with the question asked to me in an interview
    Tbl1 Tbl2
    Col1 col1
    1 1
    1 1
    1
    Inner join , left join and right join output of these 2 tables and how does it work?

    • @ashishchinna9201
      @ashishchinna9201 Рік тому

      Since both the column values are same, you will get the same result set for any type of join.
      Left Join : Each 1 from left has every 1 from right, so total 6 records.
      Right Join : Each 1 from right has every 1 from left, so total 6 records.
      Inner Join : For every 1 in left has a matching every 1 from right, so total 6 records.

  • @oddnumber8149
    @oddnumber8149 4 роки тому +1

    where is the fucking data?