HomeНаука и техникаRelated VideosMore From: kudvenkat

Sql date interview questions

170 ratings | 11028 views
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. Text version of the video https://csharp-video-tutorials.blogspot.com/2018/11/sql-date-interview-questions.html Slides https://csharp-video-tutorials.blogspot.com/2018/11/sql-date-interview-questions-slides.html SQL Server Interview Questions and Answers https://www.youtube.com/playlist?list=PL6n9fhu94yhXcztdLO7i6mdyaegC8CJwR SQL Server Interview Questions and Answers - Text Articles & Slides http://csharp-video-tutorials.blogspot.com/2014/05/sql-server-interview-questions-and.html Angular, JavaScript, jQuery, Dot Net & SQL Playlists https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd 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.
Html code for embedding videos on your blog
Text Comments (14)
365 Data Science (3 days ago)
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: https://bit.ly/2Fe6x4Q Best, 365 Data Science Online educational career website https://365datascience.com/
Ramesh Puli (16 days ago)
how to retrieve recent hiredate from employee table
Naazly Hameed (1 month ago)
May Allah bless you. Plz keep uploading videos
Habtom Nigatu (1 month ago)
I learned a lot from your videos.Thank you so much & Could you please also make a lectures for database administrator.
naseer ahmadsadiq (2 months ago)
Thank you sir for helping us Your YouTube channel is the best .
Darsh Gupta (4 months ago)
Sir , please also suggest the Oracle counterpart for these solutions to workaround with datetime
RAQIBUL ALAM RASHED (4 months ago)
ALLAH bless you sir
seethaRAM Kothapalli (4 months ago)
could you plz ulpoad emi calaculation in strored procedures with auto-genarated in month or years
Tan YEW MENG (4 months ago)
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))
kudvenkat (3 months ago)
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. https://www.youtube.com/watch?v=eYsizQVa_EU Here is the text articel for the same. Hope this helps. http://csharp-video-tutorials.blogspot.com/2012/09/datepart-dateadd-and-datediff-functions.html
Sakti Prasad Vlogger (4 months ago)
This is very very imp video which u needed much long before..Thank u sir ...
Sambit Pati (4 months ago)
Sir please make video tutorial for msbi and powerBI if possible
Yashveer Gurjar (4 months ago)
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.
Sakti Prasad Vlogger (4 months ago)
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.

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.