Transcript for:
Fundamentals of SQL and Its Evolution

Hello friends, welcome to Gate Smashers In today's video we are going to discuss Introduction to SQL, Along with the introduction, we will also discuss a little about the history of the SQL and its syllabus. Because many times the query of students comes that what are the topics we have to cover inside the sql, Whether it is about higher competitive exams or your placement, So which are the topics that have the highest weightage, which have the high priority? So first of all let's talk about SQL is what? structured query language, Here I am first picking up the word language, Why do we use the language generally? like for communication what language am I using here, I am using Hindi language, so that you guys can understand my language better which I want to explain to you. You can understand that thing well here, so what it is actually? Here you can say that there are two interfaces or there are two users here on one side and there are other users on one side. So for communication in between what do they need? language, and in the same way, if we talk about our system here, then what happens in the system on one side, There are users and on the other side there are databases, If we talk here about structure data, then database is on other side, then how will the user interact with that database? how he will communicate? By using the language, but which language? structured query language and why structure only? because we are talking about here structure means who has fixed data model, data model means whenever we store structure data what do we use? tables or what we call relation tables we also call relation, so we also call this subject many times relational database management system, because always we store data in form of relation or table. Means the structure that I have, the place where I have to enter the data is already fixed, what is that? Table, it is therefore called structure query language so whenever we have to do any query on structure data, we have to fetch the data, or to store data What do we use? SQL that is structure query language and where did the concept of Structure Query Language actually start? from 1970 in 1970 Scientist EF Code whom we call Father of DBMS. EF code published a paper on relational model, relational model means in which data is stored in the form of tables, published a paper on relational model, above that paper they tried to implement in actual theory, that we can store the data after that the data can also be fetched and whose help did he take to prove this thing? They used relational algebra, as well as tuple relational calculus in actual he used mathematical functions which is relational zebra, algebra mathematics, what do we use in tuple relations as well? Mathematics So he used these two mathematical functions using formulas inside it and then he showed that we can actually store the data at some place and then fetch it later on the basis of that paper later on IBM, IBM company started implementation in actual, because what has EF code given? gave a theoretical model of how we store data pi projection, all mathematical base functions were there, but what IBM did later was converted to this language that is structured query language and initially called it Simple English Query language, SEQUEL actual, the name of the first sequel was Sequel used to speak in this manner Sequel and its meaning is called Simple English Query Language but later what did they shorten the name to? Structure query language, but if you look carefully, we use in function even inside SQL, we use in keywords, they are of English letter only, whether select from, where, group, having, order, join which is in natural Whatever word you use here, what is it all about? Based on the English language, then this was a small history of SQL, because many times in exams or placements, they ask definitely a little bit of history, do you know about a little history, when this thing evolution started, When this thing started in actual, after that then it got full competition and in Oracle market and Oracle did complete work on it, then Microsoft made its sequel server, IBM launched its own DB2 different database. And if we talk about today's scenario, then it is totally different, now we do not talk about SQL, now we talk about no sequel, the structure data we have at today's time is very less. Only ten percent of the data on this earth, what is that? Structure ninety percent data is unstructured, for which we have no sequel big data spark mongoDB also all these concepts we use in actual, but you should know the advance but what is basic should be known first So if we talk about structure here, in structure query language the first feature that comes to us sql is a Domain Specific Language, what is the meaning of Domain Specific Language? There are two types of language, domain specific, journal purpose, journal purpose which means that the applicability is in multiple places like C, C++ language, it cannot be used at one place, you can use it in multiple areas, but if we talk about SQL, it is domain specific why is it domain specific? Because we can use only structure data, meaning only inside relational database and only what we can use inside relational database? SQL where we have our data in the form of tables? we have to fetch What language do you use in SQL, but there is no general use of SQL so it is a particular domain where we use what is that domain? Relational database, that's why we call it Domain Specific Language, the second point here is what SQL is a Declarative Language, again here also there are two categories, it is declarative and procedural, what is the meaning of declarative? What to do, what to do means we have to mention what to do but how to do not mention this but if we talk about procedural language like if we talk about c c plus plus then what would we have there? What to do happens and how to do also that means I have to mention both things inside the program what to do and how to do, so there we write procedure, write function etc., that function is actually Let me define that ok let say I want to find factorial of any number but how to do it? If we use y loop or for loop, then where is that logic also mentioned how to do? Inside the program, but here we just mention what to do means let say I have to find out the name of the student who belong to Delhi, so the students who do belong from Delhi, their details have to be removed, then we write simple query select star from students where address is equal to Delhi, so we did only mention, but how does it work internally? That is database, it works on its end, that means what to do is mentioned here, how to do we do not mention, so that's why we call it declarative language but after that I have an advance of sql which is add on feature is plsql procedural language, it is actually procedural based, but what is normal sql? Purely or Declarative Language? In this, we use the commands which are generally simple like ddl, dml, dcl, tcl, these are different different commands to create data, to insert data, to fetch, to control, In order to give privileges, which commands are there on all of them, I have already made a video on them, the link I have given in the description box, please check it, you will know that the deal is DDL,DML,DCL Which commands actually exist inside and this is the first point that you will have to do within the syllabus, which will give you an initial idea of how we work within the sequel. So here we are using keys and constraints primary key foreign key candidate key different different type of keys which are used here and constraint primary key, foreign key, not null default different types of constraints for database used to give help to create and apply rules then operators like, between, in, not in conditional I have mentioned few points here so that you will get an overview, so just what is there in syllabus actually? So in operator we like in between not in it is used a lot, apart from this we also use Exist not Exist, so all these are operators which we use internally to do query, that means we store the data done, now after that we have to fetch that data like if I tell simple simple example which all of you people use irctc what irctc has done? They have made a strong database of their own, in the database they have created a complete database of trains and what do we do, we do query how do we do query? We don't write query in sequel, you have APIs available, so we use direct application program interface and we do query like that particular day, I have to search any train, I have to search any seat inside that train , what is internally in actual, it is actually query only, which we perform on structure data and irctc is what it is based on structured data actually. When we open it then if you have seen then it is show in the form of tables, if you check from this date to this date which trains are available, which values are available then it always shows information of trains it is shown in the form of tables, so they can take an example of a structure data here. then we have this in clauses in clauses we have distance is order by group by from having this also majorly we use inside query then aggregate function main max we have average count this is different aggregate function we use join and nested query, I will give the most stars to this point here because the students who get stuck the most, where do they get stuck? In join and nested query they get stuck in sub queries or nested because they clear the basic idea but where they have to extract combined data of joins means two, three tables, they get stuck because here at Need practice, how do you have to create as many tables as possible and fetch the data inside them? this point is most important from the placement point of view I would say, It is the most important that is join and nested query but if we talk from the point of view of competitive exams, then it is also the most important obviously but the rest also keep their weightage but from the point of view of placement? This is the most important thing that is join and nested query or sub queries it is also called Correlated Queries, then PL SQL what is PL SQL ? Procedural language means that the sequel is declarative, in which we have also added the procedural part in which we create triggers, create functions, create cursors, we can also create procedures which we do in C language, we create functions in what functions can we create? inside sql but named it PL SQL so it is actually procedural, it tells what to do and how to do it? But pure SQL tells what to do, you don't need to mention how to do it because in internally libraries if you are using Oracle or Sequel Server, their libraries are already defined that What is the function of select, what is the role of commands in actual? So this is all about basics of sql