match the questions with the answers questions

match the questions with the answers questions, match, questions, answers, questions

Hi guys, this is Sahition behalf of Edureka. And I welcome youto this session on SQL interview questions. So in this sessionguys will mainly focus on the top 65 interviewquestions generally asked about SQL. Now in the era of 2.5 quintillion bytesof data being generated every day data plays a crucialrole in decision-making for business operation. This quite essentially makes us handledata and databases and gives us the need to usethe database management system with various kinds of database Management Systemspresent in the market today, the relational databasemanagement system is one of the most popularsystems available. Now this type of database management systemuses a structure that allows the usersto identify an access data in relation to another pieceof data in the database and SQL is the coreof relational database, which is used for accessingand managing the database. So definitely knowingsequel will open the doors for you to becomea database administrator. So guys if you’re preparingfor interviews to become a database administrator than SQL is oneof the important skills that you need to master in. So with the note of thislet’s just get started with the SQL interview questions. So the first question that we have is what isthe difference between delete and truncate statement. So I’ll start by explainingyou what is the delete command? Well, the delete commandis basically used to delete a row in the table. So you can also roll back dataafter using the delete statement and it is a datamanipulation command. Coming to the truncate statement,the truncate statement is basically used to deleteall the rows from a table and you cannot rollback the data. This is a datadefinition language command and it is fasterthan the delete command. So if anyone asks you thedifference between the delete and the truncate statements don’t forget to mentionthat you know, the truncate statementis definitely faster than the delete statement and the truncate statement isfrom the data definition family and the delete statementis The data manipulation from the right now moving onto our next question that is what arethe different subsets of SQL. Well, the different subsets of SQL are mainlythe data definition language the data manipulation languagethe data control language and the transactioncontrol language now coming to the data definition languagethis set of language consists of the commands that can be used to definethe database schema. So whenever you wantto define the database schema, you can use the commands fromthis particular language coming

match the questions with the answers questionsyou can use the commands fromthis particular language coming to the datamanipulation language the manipulation languageconsists of all the commands that deal with the manipulationof data presented the database. So for example, if you have n numberof tables and you want to manipulate the dataand present in those tables, then you use datamanipulation commands coming to the data control language the data control languageincludes the commands which deal withthe right permissions and other controlsof the database systems. So for example, you work for an Enterpriseand the Enterprise has a database now, obviously all the employeeswill not have the access to the database right sodata control language. Mainly deals with how you givethe user permissions to access to the database now comingto the last type of language that is the transactioncontrol language. This basicallyincludes the commands which mainly dealwith the transaction of the database wheneveryou want to roll back or you want to perform anyvarious kind of transactions, then you use the set of commandsfrom this language, right? So, I hope I’m clear. So as I said, there are mainlyfor different subsets of sequels that you should mention that is the datadefinition language the data manipulation languagethe data control language and the Construction Controllanguage now moving on to our next question. That is what do you meanby database Management systems and what arethe different types of it? So now if I have to define the database managementsystem for you, then a database managementsystem is a software application that interacts withthe users applications and the databaseitself to capture and analyze the data. So the data stored in a database can be modifiedretrieved and deleted and can be of any type likethe strings numbers images Etc. So you can basicallystore any kind of data. Not a different kindsof database Management systems are the hierarchicalthe relational the network and the object oriented databaseManagement Systems the talking about the hierarchicaldatabase Management Systems this type of databasemanagement system has a style of predecessor and the successivetype of relationship. So it has a structuresimilar to that of a tree while in the nodesrepresent the records and the branches of the treerepresent the fields coming to the relational databasemanagement system this type of database management systemuses a structure that allows the user to identify and access data in relationto another piece of data

match the questions with the answers questionsand access data in relationto another piece of data in the database the networkdatabase management system supports many to many relations where in multiple memberrecords can be linked and the object oriented databaseManagement Systems use a small individualsoftware called objects and each object contains a pieceof data and instructions for the actions to bedone with the data. So I hope I’m clearwith this point. So now moving onto our next question that is what you mean by a tableand a field in SQL. So now the answer to this question is quite simpleat a Basically refers to a collection of datain an organized manner in forms of rows and columns and the fieldrefers to the number of columns in the table. If you have to explainanybody what table and field mean sobasically in SQL, you have a database and the database consistsof n number of tables, right? So that is basically a table and the tables havefew column names, right? So the column namesare basically the feet so you can explain with an example as you can seein the screen so over here, I have an employeeinformation table into which the employeeinformation table is a table and the column namesin this particular table are the fries now moving onto our next question. That is what our joints in SQL. Now, this is oneof the most popular questions that is generally askedin your interviews. So basically a joint Clause isused to define to combine rows from two or more tables basedon related columns between them. It is used to merge two tablesor retrieve data from there and there are mainlyfor types of joints in SQL. That is the inner jointhe full joint the left join at the right joint right nowmoving on to our next question. Is what is the differencebetween care and warka to data type in sequence? So this is one of the mostconfusing questions that is generally askedin an interview you’ll see you since you know generallypeople get confused between what is care. And what is vodka datatype now both Karen barca to are usedfor character data type, but work at to is usedfor character strings of variable length, whereas the cat is usedfor strings of fixed length. So whenever you havestrings of fixed length, then you use the cad data types and whenever you have strengthsof variable length, then you can usethe warka to data type for example cat thencan only store 10 characters and will not be able to storea string of any other length whereas to work at 2:10can store any length that is either 628. It completely depends

match the questions with the answers questions It completely depends

match the questions with the answers questionsIt completely depends on the variable right nowmoving on to our next question. That is what is the primary key. Now when you’re workingin a database field, obviously a company you can haven number of databases having n number of tables inside thisnow each and every table in a database hasto be connected with the other tableright now for that. We need to unique I didn’t fighta table or you know, you can say you needto uniquely identify a column. So basically primary keyis a set of attributes that can be used to uniquelyidentify every Tuple. So if there are three to four candidate Keyspresent in a relationship then out of those one can be chosenas the primary key. Now, as you can see on the screen, we havean employer information table which has columnslike, you know, employee number employeenamed employee country and the employee age now, obviously you can uniquelyidentify each and every employee with the employee ID, right? So basically thatwill be a primary case over here employee numberwill be a primary key. Now. Let’s move on to a next questionthat is what our constraints so constants are basicallyused to specify the limit of the data typeof the table, right? So whenever you’recreating a table, then you can use the constant to set a limitof the data type of the table. It can be either specified while either creatingthe table or you know, while you’re orderingthe table statement so it can be basically specified in both the ways now thereare mainly five constraints that you need to understand about that is Not nullconstraint the unique constant the check constraintthe default constraint and the index constraint that the not nowconstant basically ensures that a null valuecannot be stored in the column. So whenever you mentionthis particular constant into a column of your table, then this particular constantwill make sure that you know, no null value can be storedfor that particular column in the table moving onto the next constant. That is the unique constant this constant makesure that you know, all the values in the columnare basically different. So if you need to make sure that you know in a columnyou have unique values for each and everyrow then you can use this particular constraint nowmoving on to the next constant. That is the check constraint thecheck constant basically ensures that all the values in the column satisfyspecific condition. So if you have a condition youneed to make sure that you know, only the values

match the questions with the answers questionsonly the values with satisfy the conditionare stored in the column, then you can use this particularconstraint now talking about the default constraintdefault constant consists of a set of default values for a column withno value specified. So for example in a tableof ten rows No, you have a column in which youdo not specify all the values for all the 10 row then you can make surethat you know, you will set a default value in the default valuewill be automatically stored wherever youdon’t mention a value in in that call now moving onto the last step of constant. That is the index contrary. The index constraintis used to create and retrieve data fromthe database is very quickly. So I hope I’m clear with thedifferent types of constraints that you need to answer about when you’re asked his questionabout what are the constraints that you know, now let’s move onto the next question that is what is the differencebetween SQL and my SQL now, this is one of the mostpopular questions that is generally ask, you know, because since people generallyget confused between what is SQL and what’s my sequel solet me just explain you the simple differencebetween both of them. So SQL is basicallya standard language which stands for structuredquery language based on the English language. Whereas the MySQL isa database management system. So SQL is basically the coreof relational database which is used for accessingand managing the database. But as my SQL isa relational database. Iseman system which workson many platforms. So basically this providesmulti-user access to support many storage enginesand is backed by a rocker. So that’s the basic differencebetween SQL and MySQL guys SQL is basically the coreof relational database which is used for accessingand managing a database and MySQL is an open source relationaldatabase management system. Now, let’s move overto our next question that is what isthe unique key now unique key basically identifiesa single row in a table. This basically allows multiplevalues per table and also the null values are allowed so you’ll have to make surethat you know, whenever using the unique key, you need to have an ideathat you know, it identifies a single Row in the table multiple valuesare allowed for the table and also null values are allowed but yes duplicate valuesare not allowed. All right now moving forwardto our next question that is what is a foreign keya foreign key basically maintains referential Integrity by enforcing a linkbetween the data into tables the foreign keyin the child table. Friends is the primary keyin the parent table and the foreign keyconstraint prevents actions that would destroy the linksbetween the child and the parent table. So if you have a databaseand you know, if you have around 10 tables in that particulardatabase and then if you want to maintainrelations between all these tables in the database, then you need to use the primarykey foreign key concept so that you identify the relation between boththese tables with the help of foreign key now movingforward to a next question. That is what do you meanby data Integrity now data Integrity basicallydefines the accuracy of the data as wellas the consistency of data stored in the database. It also defines the Integrityconstraints to enforce business rules on the data when it is enterinto an application or a database. So if you have toanswer this question, then you can answerby saying that, you know data Integritybasically defines the accuracy and the consistency of data. Now, let’s move forwardto a next question that is what is the differencebetween the clustered and the non-clusteredindex in SQL. The clustered indexis basically used for The easy to retrieve allof the data from the database and is faster than the non-clustered indexthe clustered index Alters. The way records are storedin the database as it sorts outthe rows by column which is set to bethe clustered index and only one table can havea clustered index coming to the Dom clustered indexthe non-clustered index is also used for the retrievalof data from the database. But yes, it is slowerthan the cluster index the non-clustered index doesnot alter the way it is stored. But yet it createsa separate object within a table which points back to the original tablerows after searching and also one table can havemany non-clustered indexes the main differencebetween both of them are what are used for easyretrieval of data, but yes, the clusteredindex is faster than the non-clustered index and only one table can haveonly one cluster index but yes a single table can havemany non-clustered indexes apart from that the third differencebetween both of them is also that you know, the cluster index Alters the wayrecords are stored in the table and the non Plus. Index does not do that. Now. Let’s move forwardto our next question. That is write a SQL queryto display the current date. Now when youattend the interviews for a database administrator, let me just tell you that not only the theoreticalquestions are asked but yes, yes sometimes askedto write the query is also so they can give yousome scenarios questions or they can just askyou a few simple queries that you need to make sure that you know, you know them so that’s the reason that this questioncould be asked that, you know, write a SQL queryto display the current date now in SQL to displaythe current date. We have a functionknown as the get day. So basically with the helpof this function, you can return the current dateand time stamp. So the syntax of functionis really simple as just get date and itapplies to SQL Server 2000 17 16 14 12 2008R2 2008 and 2005. If you just have to givean example to the interviewer about how to write a queryto display the current date. You can just mentionthe query like, you know select get day. So when you executethis particular query you would see an output that youknow the current date and time. I would be displayedas out right so that’s how you can writea query to display the current date now movingforward to the next question that is what arethe different types of joints. So as I mentioned before there are mainlyfor types of joints that you need to talkabout that is the inner join the full join the left joinand the right joint. So talking about inner join this joint basicallyreturns to circuits which have matching values in both the tables now considertwo tables table a and table B. Now when you applythe inner join on both of these tables you’ll observethat, you know, the output would beall those records which have matching valuesin both the tables that is table a and table be the talkingabout the full joint the full joint basicallyreturns all those records which either havea matching value in the left or the right table. So whenever you apply full join in both of these tables,you will see that, you know, you get an outputof all those records which either havea match in the left or the right table now talkingabout the left join the left jaw and Returns the recordsfrom the left table and also those records which satisfy the conditionfrom the right table. So if you have table aand table B, and you apply a left join, too. Of the Stables then the outputwould be all those records from the left table and the recordfrom the right table which satisfy thespecified condition. Similarly. The right joint is justthe vice versa the right joint basically returns a recordfrom the right table and also those recordswould satisfy the condition from the left table. So whenever you applythe right choice in to table a and table be and considerthat you know, the table B is right tableyou’ll get all those records from the table p and alsomatching records from table a which satisfy the condition. So these are the various typesof joints that you need to talk about guys now moving forwardto the next question. That is what do you meanby denormalization now denormalization basically refersto a technique which is used to access the data from higher to lowerforms of database. It increases the performanceof the entire infrastructure as it introducesredundancy inter table and it also addsthe Redundant data into a table by incorporating databasequeries that combined data from various tablesin a single table. So if you have to justexplain denormalization, you can just saythat you know, it is a Sneak which is used to access data from higherto lower forms of database and it basically adds written the data into the table byincorporating database queries that combine datafrom various tables. So I hope I’m clear with this point now movingforward to the next question that is what are the entitiesand relationships. So let me just explain youwhat entities are first so entities can be anything like, you know a person placeor thing in real world about which datacan be stored in a database. So table stored data that represent onetype of entity. So for example, a blank database hasa customer tables to store the customer information. Now the customer Table stores this information asa set of attributes that is basically the columnswithin the table for each and every customer. So if you consider, you know, a customer tablehas around five parameters, like customer ID customer name customer phonenumber customer email ID and so on then all these customer ID customername customer phone number are basically the column names that is the attributesfor the entities and customer informationwill be the entity the talking about relationships relational. Between the entities that have somethingto do with each other is basically relationships. So for example, the customer name is relatedto the customer account number and the contactinformation right. Now. This might be in the same table or it could bein any other table also, right. So if you have two tables out of which one tablehas the customer name and the other table hasall the other information like the customer IDcustomer name and so on. Now these two tableswill be related to each other with the relationship so that the customer detailscould be retrieved now that particular informationis basically relationships now moving forwardto our next question that is what is an indexin the previous questions. I talked aboutthe non-clustered index and the clusteredindex is right, but what exactly is index now index basically refersto a performance tuning method of allowing faster retrievalof records from the table. So as I mentioned before in the plastered on thenon-clustered indexes question, both of the indexesare basically used for easy retrievalof data, right? So that’s what indexdoes this is basically a performance tuning method toallow faster retrieval of data. From the table and also an index createsan entry for each value. So to allow the faster retrievalof records from the table it basically creates an entryfor each and every value. Now, let’s move forward tothe different types of indexes. So well, I’ve already explainedyou about two types of indexes that is the clustered andthe non-clustered index but yes, let’s understand againabout both of them and also an additional indexthat is the unique index. So mainly there are three typesof indexes that is used that is the unique index the clustered indexand the non-clustered index the unique index basically does not allow the fieldto have duplicate values if the column is unique indexed. So for primary keyis defined a unique index can be applied automatically. So unique index is mainly used when you do not want anyduplicate values to be present in the column now moving to the clustered indexthe clustered index basically reorders the physicalorder of the table and searches basedon the basis of key values. So each table can have onlyone cluster index coming to the third typeof index Teresa nonplussed. Indexed non-clustered index doesnot alter the physical order of the table and maintainsa logical order of the data. So each table can have manynon-clustered indexes, right? So basically guys thereare three types of indexes that you need to explain aboutthat is the unique the cluster and the non-clustered indexnow moving forward to our next question. That is what this normalizationand what are its advantages. So normalization isbasically the process of organizing data to avoidduplication and redundancy. So it’s basically the oppositeof denormalization that we just talked about in oneof the previous questions. So if you just haveto Define normalization, then you can seethat you need is a process of organizing data to avoidduplication and redundancy. Now the advantagesof normalization are as you can see on the screen, it offers better databaseorganization more tables with small rose efficientdata access greater flexibility for queries quickly findsthe information easier to implement security allowseasy modification reduction of redundant data and duplicate datamore compact database. And ensures consistent dataafter modification. So Guys, these arefew advantages of normalization. Now, let’s move forwardto our next question that is what is the differencebetween the drop and the truncate commandsthe crop command basically removes the table and it cannot be rolled back from the database wheneveryou use the drop command just remember that, you know, you completely dropthe complete table and it cannot be rolledback from the database and the truncate command removesall the rows from the table and also cannot be rolledback into the database. So the drop command and the truncate commanddiffer by this. So whenever you usedto draw from and you drop the complete table and whenever you will useto truncate command, you will remove allthe rows from the table the syntax of both. Our commands are almost samethe syntax of drop command is basically dropobject in object name that is basically the tableand table name and the Syntax for truncate command istruncate table and table dream. So guys that was about the dropand the truncate command. Now, let’s move forwardto the next question that is what are the differenttypes of normalization. So there are mainlyfor types of Vicious that is 1 and f 2and F 3 and F and bcnf. Now, let me explain you the different types ofnormalization with an example. So guys, this is the table that we’re going to considerfor the example. Now you basically haveto apply normalization for this particular table the to apply normalizationto this particular table. You’ll clearly observethat you know, there is Alice Johnson who has a particular address and has rented few moviesfrom a specific category and the category actionis mentioned twice over here. Similarly. David Allen’s addresshas been divided into two different record. And the movies rented in the categorieshave also been divided into two different recordsright now to apply normalization to this particular tableyou first have to apply the one in them. That is thefirst normalized form. So for a table to win oneand if you need to make sure that each table cellsshould have a single value. So basically allthe records must be unique. So as you sawin this particular table, we had redundant valuesin the same record, right? So we’re going to have each cellwith a unique record. So we’ll have recordssuch as you know. Alice Johnson First Street housenumber 3 mission impossible and the second recordas Miss Alice Johnson for Street house number3 Clash of Titans. Similarly. We’ll have mr. David Allen Third Street fortifywith Interstellar the mr. David Allen Third Street 45 withEdge of Tomorrow and similarly. Mr. David Allen 7th. Annual MissionImpossible fall out. So that’s all basically youget your table into one. And if you have recordswith unique value in the complete table nowas you can see on the screen, this is a tablefor one and left. Now, you have to dividethis table to 2 and F. So when I said to and if that isthe second normalized form, you can divide this tableinto two different tables, so to have a table into and if you need to make surethat you know, the database should be in one in if and should also havea single column primary key since the table is in 1nf that we consideredthat’s applicable to our situation. Now, let’s move forwardto the 2N them now in the to and there will clearly seethat you know, we have salutationsfull name address and movies rented right? Let us divide this People needto do different tables. You can clearly seethat, you know, I’ve added an IDto both the tables. So I’ve added ID salutationfull name and address and ID movie stranded so Miss Alice Johnson stayingin First Street house number 3 must have rentedMission Impossible. Similarly. She must have rentedClash of Titans. Mr. David Allen thing Interstate45 has entered Interstellar and Edge of Tomorrow. And mr. David Allen staying in 7th. Avenue has rentedMission Impossible fall out. So that’s how I’ve dividedthe table and to do and they’re now movingforward two three left now a database to be entry and if you need to make surethat you know, the or databaseis person to an f and must not have any transitivefunctional dependency. So for that what you’re goingto do is you’re going to further divide the two tablesinto three tables as you can see in the screen. So we’re going to havean ID full name address and salutation ID, and also another table with IDmovie stunted column attributes and the third tablewith salutation ID and shallot Asia. So basically we’re goingto identify mr. With one miss withto This with three and doctor with for so that’s how we’re goingto get a tables to 3nf. Well guys with thiswe come to an end of this particular example that you are tableis been completely normalized and the highest normal form available for thisparticular table is tree and are now moving forwardto the final type of normalization that is bcnf. Now if your database isin third normal form and they would besome scenarios where anomalies would be present. And if you have morethan one candidate key then bcnf comes in to roll when you further divideyour table so that you know, they would be onlyone candidate key present. So Guys, these are the varioustypes of normalization that is 1 and f 2and F 3 and F in bcnf. So in 1nf, there is no repeating groupswithin the rows into an app every non-keycolumn is dependent on a whole primary key in 3nf. It is completely dependenton the primary key and no other non-keycolumn values and in bcnf, you have to make surethat you know, there’s only one candidate keypresent in the team. So Guys, these werethe different types of normalization that youneed to understand about now, let’s move What our nextquestion that is what is acid property in database the assetproperty mainly stands for atomicity consistencyisolation and durability. It is basically used to ensure that the data transactionsare processed reliably in a database system. So if you have to Defineasset property in a database, then you have to Define allthese terms individually a stands for atomicity. So Atomic City refersto the transactions that are completelydone or failed where transaction refers to asingle logic operation for data. It means if one partof any transaction fails, then the entire transactionfails and the database state is left unchanged coming toconsistency consistency ensures that the data must meetall the validation rules in simple words. You can see that you know,your transaction never leaves the database without completingits take third part that is isolation. The main goal of isolationis the concurrency control and the last part that isdurability durability means that if a transactionhas been committed it will occur whatever may come in between Tosuch as far large crash or any sort of error. Now, let’s move forwardto our next question. That is what you meanby a trigger in SQL. So triggers and SQL are a special typeof stored procedures that are defined to executeautomatically in Play store after data modifications. It allows you to executea patch of code when an insert update or any other queries executedagainst the specific table. So guys, there aremainly 6 type of triggers that you need to understandabout that is the before insert after insertbefore updateafter update before delete and after delete. So basically thetwo main key terms that you need to understandat the before and the after so theseare completely applied on the insert updateand delete commands. The before insertis basically activated before the data is insertedinto the table. The after insert is activated after the data is insertedinto the table. The before update is activated before the datain the table is updated and after update is activated after the datain table is updated. The before delete is activated before data is removedfrom the table. After delete is activated after the data is removedfrom the table. So as this is what a trigger in SQL s it is basically a typeof stored procedures that is defined to executeautomatically in place or after data modifications. Now, let’s move forwardto our next question that is what arethe different types of operators available in SQL. So there are mainly five typesof operatives available in SQL. That is the arithmetic bitwise comparison compound and The Logical operators. So as these arethe main file types of operators available in SQL. So now let’s move forwardto our next question that is our null values same asthat of zero or a blank space a null value is not atall same as that of a zero or a blank space an l-valuemainly represents a value which is unavailable unknownassigned or not. Applicable. Whereas a zero is a numberand a blank space. It’s a character. So if anybody asks you if null values are sameas that of 0 blank space, please say it’s knowbecause you know, the null valuesis basically anything which is unavailable unknown orand is s And the not applicable but as a zero is a number and a blank spaceis a character. Now, let’s move forwardto our next question that is what is the differencebetween a cross joint and a natural join the crossjoint produces the cross product or Cartesian productof two tables, whereas the natural joinis based on all the columns having the same name and data typesin both the tables the main differencebetween both of them is that in the crossjoint basically produces the cross productof both the table and the natural joinis completely based on all the columns havingthe same name data types in both the team now, let’s move forwardto our next question. That is what is a sub queryin SQL a sub-query is basically a query inside under the query where a query is definedto retrieve data or information backfrom the data base. So some queries arealways executed first and the result of the sub-queryis passed on to the main query. So as you can see on my screen, I have an outer queryinside which I have a sub query or an inner query. So basically the squareis assigned to retrieve data from the database and then the squareWill be executed first. So if there are any errorsin this query then the complete querywould not be executed only when the stock queryis completely executed. Then the outer querywill be executed. Now, let’s move overto the next question that is what are the differenttypes of sub-query. Now, there are mainlytwo types of sub queries. That is the correlated andnon correlated sub-query. The correlated subqueriesare basically those queries with selected datafrom a table referenced in the outer query. It is not consideredas an independent query as it refers to another tableand the first column in a table. The non correlated sub-queryis an independent query where the outputof the sub-query is substituted in the main coil. So you’ll have tounderstand the difference between both of them. If you do notunderstand by definition, you could definitely goand execute the commands right the two different typesof queries in SQL and you get to know whatI’m talking about basically non-correlated typeof sub query the output of the sub-querywill be substituted into the main queryand correlated type of sir. Create the query select the data from a reference tablein the outer query. Now. Let’s move forwardto our next question. That is can you listthe ways to get the count of Records in a table nowto count the number of Records in a table, you can use variouskinds of queries. So there aremainly three queries that have mentioned over here. That is Select star from table1 star means basically select. All right, when you want to select all the rows allthe records in the table, you can use star next when I say select count starfrom table 1 that is basically you select allthe records from the table 1 and then you count them and coming to the thirdquery data select rows from system in Texas where ID object ID of table1 and indeed is less than 2 that means is basically Councilnumber of Records in the table with system in Texas. These are the various waysto count the number of Records in a table. Now, let’s move forwardto our next question that is write a SQL queryto find the names of employees that begin with the alphabeta now to display the name of employees that beginwith a you Type in the command like you don’t selectstar from table name where you mentionedyour table name where employ name because I’m consideringan employee table in the scenariolike a percent in quotes So when I say a person allthose names starting with a and having any lettersor any characters after that would be selected. So guys, that’s how you can write a queryto find the name of employees that begin with a now suppose. If you want to write a queryto find the names of employees that end with a what youcan simply do is you can against either similar querylike in a select star from table name where employ namedlike percentage a rights over the percentagecomes forward that means, you know all the names that start with any alphabetbut end with the a will be considered now, let’s move forwardto our next question that is write a SQL queryto get the third highest salary of an employee from an employee table nowto get the third is salary of an employeefrom an employee table. You can write a queryas you can see on the screen. You can just mentionselect top one salvi from and then write a sub query which says select top three V from employee tableorder by salary in a descending order as M and then again orderby salary in ascending order for the outer query so you can write a querylike this Christ. Now, let’s move forwardto a next question that is what is the needof group functions in SQL now group functionswork on a set of rows and return one result per group. So basically some of the mostcommonly used group functions are the average countMax Min some and variance So when you say what is the needof group functions in SQL the need is basically because the group functionswork on a set of row and return one result per group. Now, let’s move overto our next question that is what is a relationship and what are the differenttypes of relationship. So the relation or links between entitiesthat have something to do with each other can be basicallytermed as relationships. So relationships can be alsodefined as the connection between the tablesin a database right now. The different typesof relationships are the one to one relationshipthe one to many relationship many to one relationship and the selfSensing the relationship when you have a relationship between two tablesat his table a and table be so when I sayone-to-one relationship between both the tables table a and table be a single recordingtable a will be related to a single recordin table be coming to one-to-many relationshipa single recording table a can be related to many records and table P next coming to the many to onerelationship many records in table a can berelated to one record in table be coming toself-referencing relationship. The self-referencingrelationship basically means that you can have a single tableout of which two columns are related to each otherwith the relationship. Now, let’s move overto a next question. That is how can you insertnull values in the column while inserting data now toinsert null values in a column while inserting the datayou mainly have two ways that is either by implicitlyby omitting columns from columnist or explicitlyby specifying null keyword in the values Claus. So as these are the two waysthrough which you know, you can insert nullvalues in a column while in I think the data now, let’s move forwardto the next question that is what is the differencebetween the between and in condition operators. The between of it is basicallyused to display rows based on a range of values in a row. Where as the in conditionoperator is used to check for values containedin a specific set of values. So if you have to explainwith an example for between and in condition operators, then you can usethe example on the screen. You can just write a query likein a select star from students. We’re rolling werebetween 10 to 50. So all those records from the students tablewould be selected whose role number standsbetween 10 to 50 coming to the in condition operators. You can use a querylike this like, you know, select starfrom students were roll number in eight fifteen twenty five. So all those records from astudent table would be selected where the roll numberwould be either eight fifteen or twenty five. So guys, that is the main differencebetween the between and the in condition operators. Now, let’s move forwardto our next question. That is why arethe SQL functions? The SQL functions are usedto perform some calculations on the data to modifyindividual data items to manipulate the outputto format dates numbers and also to convertthe data types. So if you want to performthese activities or you know, if you want toperform these actions, then you need to usethe SQL functions. Now, let’s move forwardto our next question that is what is the needof merge statement. This statement is basicallyused to allow conditional update or insertion of datainto a table. So it performs an updateif a row exist or an insert if the road doesn’t exist. So basically the need of merge statement isthat you know, it allows conditional update orinsertion of data into a table. Now, let’s move overto our next question. That is what do you meanby recursive stored procedure recursive stored proceduresrefers to a stored procedure which caused by itself until it reaches some boundary conditionthis recursive function or procedure helpsthe programmers to use the same set of coden number of times. So basically you’ll firstmention the boundary condition and then you are you Recursive stored procedureto check you know, if it calls by itself till it reaches thespecified boundary condition. Now, let’s move forwardto a next question that is what is a clause in SQL. Now sequel Clausesbasically helps you to limit the result set by providinga condition to the query across helps to filter the rowsfrom the entire set of Records. So for your better understandingthe example is basically where and having Clauses. So when you writea query you having these two particular Clauses youbasically mention a condition into these particularClauses, right? Like we’re student numberis equal to 2 or having, you know goal numbergreater than 5 and so on right? So that’s how youcan use Applause in SQL. Now, let’s move forwardto the next question that is what is the differencebetween the having clause and the where cross but the main differencebetween having clause and where Clauses basicallythat you know, the having Clause can be onlyused with the select statement. It is usually used by the groupby clause and whenever Group by is not usedhaving basically behaves like a where Clause comingto the where Clause the where Clause is applied. Each row before theyare part of the group by function in a query. So having Clause is basicallyused with the select statement and it is usually usedin the group by Clause when the having Clauseis not used with the group by Clause the having Clause behaveslike a where cross so guys that was about the differencebetween the having clause in the where Clause now, let’s move forwardto our next question that is list of ways in which Dynamic SQLcan be executed the ways in which Dynamic SQLcan be executed our by writing a querywith parameters using exact and by using SP – execute SQL. So there are basicallythree ways in which Dynamic SQL can be executed that is by writing query withparameters using X and using SP underscores execute SQL. Now moving forwardto the next question that is what arethe various levels of constraints the constraints as I mentioned before Ibasically the representation of a column to enforcedata entity and consistency. So Bailey there aretwo levels of constants. That is the columnlevel constant and the table level constraint now, let’s move Overto our next question that is how can you fetchCommons records from two tables? Well, you can fetch cam records from two tables by usingthe intersect statement. So the syntaxof intersex statement is as you can see on the screen. It’s basically select column1 column 2 and so many columns from the tablename where condition basically, we you mentionedthe condition over here. Then you mentionthe keyword intersect and then again mentionedunder the table name, right? So that is again, you mentioned select the columnsfrom a specific table where the condition matches so that’s how you usethe intersect so mad so for your better understandingyou can see the example on the screen youcan see you know that I have usedselect student ID that is basicallya single column from student then use the intersect command. And then again, I’ve mentioned select student IDfrom a different table that is exam. So that’s how youcan fetch common the courts from two tables. Now, let’s move forwardto our next question that is listen casemanipulation functions in SQL. So there are mainly three casemanipulation functions in SQL. That is the lower upper and the in eat cap the talking about the logo Shouldn’tthis function basically Returns the string in lowercase. It takes a string as an argument and returns it by convertinginto a lower case the syntax of this particular function isbasically lower and in Brackets, you mentioned stringsin quotes now moving forward to the next function. That is the upper functionthis function Returns the string in uppercase. It takes a string as an argument and returns it by converting itinto an upper case, right? So the Syntax for this particular functionis upper and in Brackets, you mentioned the springwithin the codes moving forward to the third functionthat is the in each cap. This function Returns the stringwith the first letter in uppercase and the restof the letters in lowercase. So the Syntax for this function is basicallyin each Gap and in Brackets, you mentioned thestring with coats. So Guys, these were the three case manipulationfunctions in SQL. Now, let’s move forwardto our next question that is what arethe different set of operators available in SQL. So the different set operatorsavailable in SQL our Union intersect and the – operators, so let’s talkabout Union first. So when you consider Whathe said is the left query and the right query and you apply the unionoperation you will see that you know, it will combine Rosefrom both those queries. You’ll get an outputof you know, all those recordsfrom the left table. That is basically the left queryand also from the right query that is the right table movingforward to the next operation is the intersect operation. So when you applythe intersect operation to the left query and the right query you’ll seethat you know, you’ll get only those rows which are commonin both the queries, right? So for example, you have ten rowsin the first table and ten rowsin the second table, but the common Rose in both these tableare just two rows. So you’ll get onlythose two rows as an output to this particularoperation moving forward to the third type of operation. That is the – operation. So when you apply left query – right query you’ll see that you’ll get the onlythose rows from the left query which are not includedin the right query as an output and when you applythe operation of right query – left query you’ll see that here you’ll get onlythose rows as an output from the right querywhich are not included. It in the left query. So Guys. These were the different setof operators available in SQL. That is the union operator the intersect operatorand the minus operator. Now, let’s move forwardto a next question that is what isan alias command. Now here is name can be givento any table or any column. So the scale is namedcan be referred in where Clause to identifya particular table or a column. So that’s basicallyan alias command. So for example, if you see on the screenyou see a query right? Let’s select m dot employeeID department DOT result from employ ampDepartment as depth where m dot employee ID is equalto Department employee ID. So what I’ve given over here is that I’ve given an alias nameto the employee table as M. And for the Department table, I’ve given an aliasname as depth. So that’s how you can usethe Alias command guys. Let’s move forwardto the next question. Now that is what our Aggregateand scalar functions. The aggregate functionsare used to evaluate mathematical calculationand return a single value. These calculations are donefrom columns in a table. So for But if you need to considerthe aggregate functions, then you can considerthe max function and the count function asan aggregate function now coming to the scalar functionsthe scalar functions basically return a single value basedon the input value. So if you need an examplefor scalar functions, then you can consider the UK’sand now a scalar functions as they’re calculatedwith respect to the spring. So guys, this is what aggregate functionsand scalar functions mean. Let’s move forwardto the next question. That is how can you fetchalternate record from a table. When you answer this questionof how you can fetch alternate records from a table. Please make sure that youwill you mention a point that you can fetch alternate because that is both the oddand the even row numbers now to display the even row numbersyou can use the command like, you know, select student IDfrom select row number 2 net ID from student again. We’re moored row numbercomma 2 equal to 0. So we’re using this functionof where Ma Drew number comma 2 equal to 0, right. So when you dividethe row number with to and if you get the reminder as 0 then that particular row numberwould be an even number and Lily if you get a reminder as 1 thenthat particular row number would be an odd number that’s how you can segregatethe alternate recalls. That is the even number recordsand the odd number records. You just have to mentionthe condition madro number comma 2 equal to 0 if or even and madro number comma2 equal to 1 for odd now, let’s move forwardto the next question that is named the operator which is used in query forpattern matching the operator, which is used in the queryfor pattern matching is basically the like operator soin like operator, you can use eitherthe percentage sign or the underscore sign the percentagesign basically matches to zero or more characters. If you use the percentage sign in the query like ina select star from students where student namedlike a percentage so all those student nameswhose name starts with a and ends with any characterwill be taken into account and all the informationrelated to all those records will be retrieved and coming to when youuse the underscore sign the underscore sign basicallymatches exactly one character. When you use the underscore signin the query like, you know select starfrom student by student name like ABC underscore. So all those records, you know whose studentname has a characters which match the patternABC and any character present after that will betaken into account. So guys, that’s how youcan use the like operator for pattern matching. You can either usethe percentage sign with it or an underscore sign with it. Now, let’s move forwardto the next question. That is how can you selectunique records from a table? Well, you can selectunique records from a table by using the distinct keyword. So for your better understandingyou can write a query like, you know, selectdistinct student ID from student, right? So with the help of this queryall the unique records from the student tablewill be selected. Let’s move forwardwith the next question. That is how can you fetchfirst five characters of a string now, there are obviously a lotof ways to patch the characters from a string. So for your understanding I’vementioned two examples over here that is either you can usethe substring command or the right command. So when you use the substringstatement you can use the Smells like you know selectsubstring student named want to fight a studentnamed from student. The first five charactersof student name will be retrieved fromthe student table now similarly when you usethe right statement, you can use the statements like, you know, Selleck bright studentname comma five a student named from student, right? So with this query again all the first five charactersof each and every student name from the student tablewould be retrieved. So that’s how guys you can fetchthe first five characters of a string that is either by usingthe substring statement or the right State now, let’s move forwardwith the next question that is what isthe main difference between SQL and pl/sql. The sequel as I mentionedbefore is a query language that allows you to issuea single query or execute the single insert update. Delete whereas PL / sequel that is basically oracle’s procedural language SQL allowsyou to write a full program of Loops variables Etc toaccomplish multiple operations such as select insertsupdates and deletes. So is that isthe main difference between SQL and procedure? Language sequel in SQLyou just have to write a single query to executeinsert update and delete and in procedure wrangled SQL. You have to write full program with loops and variablesto perform multiple operations, like insert updatedelete and selects. Now, let’s move forwardto our next question that is what is a view a view isbasically a virtual table which consists of a subsetof data contained in a table since views are not present. It takes less space to storeand Views can have data of one or more tables combinedbased on the relationship. So as you can see on the screen, I have two tables of you aren number of rows and columns now once I execute a query to forma view you can clearly see that, you know, it has combinedThe Columns and the rows from both the tables and has created a view of both of these tablesinto a single table. That’s what a view is. Now. Let’s move forwardto the next question that is what our views used for so views as I just explained basicallyrefer to a logical snapshot based on a table or on any otherview it is used for restricting. The access to dataare making complex where the simpleensuring data Independence and also providingthe different views of the same data. So that’s what viewsare used for. Now. Let’s move forwardwith the next question that is what is a stored procedure a stored procedure isbasically a function which consists of manySQL statements to access the database system severalSQL statements are Consolidated into a stored procedure and are executed wheneverand wherever required which obviously saves time and we can avoidwriting code again. And again, so with the help of stored procedureyou can make sure that you know several SQLstatements are executed again and again and you don’t haveto write the query for it again because you know you if you just havea stored procedure for it, it will automaticallyexecute the queries for you. Now, let’s move forwardwith the next question that is list some advantages and disadvantagesof stored procedure. Let’s talk aboutthe advantages first. So stored procedure can be usedas a modular programming which means create one store and code for severaltimes whenever it is. Quad the supports faster execution and italso reduces Network traffic which provides better securityto the data coming to the disadvantagesof stored procedure. The only disadvantageof stored procedure is that it can be executedonly in the database and utilizes more memoryin the database server. So as that wasabout the advantages and disadvantagesof stored procedures. Now, let’s move forwardwith the next question that is list all typesof the user defined functions. So there are mainly three typesof user defined functions. That is the scalar functions theinline table valued functions and the multi statementvalued functions. So you may only have to mentionthese three functions when you’re askedabout the different types of user defined functions next. Let’s move forwardand understand. What do you mean by collation? So Collision is defined as a setof rules that determine how data can be sortedas well as compared. So character datais sorted using the rules that Define the correctcharacter sequence along with the options for specifyingcase sensitivity character with and excetra. So that’s what a Nation isguys it is basically a set of rules that determine how data can be sortedas well as compared. Now. Let’s move forwardwith the next question that is what are the differenttypes of collision sensitivity. So the different typesof collisions sensitivity are the case sensitivitythe corner sensitivity the with sensitivity and the action sensitivity. So there’s these arethe mainly for types of sensitivities of collision. So I hope that you’ve understoodtill now next in the session. Let’s understand. What are the local andthe global variables now talking about local variables first, these variables can be only used or exists onlyinside the function. These variables are not used or can’t be referred byany other function, right? So whenever you wantto use local variables, then you need to understandthe fact that you know, they can be only used or existinside a single function and they can’t be referredby any other function coming to Global variables. These variables are thevariables which can be accessed throughout the program. So Global variables cannot be created wheneverthe function is called, but yes, they can be accessedthroughout the Graham so guys that was about the lookand the global variable next. Let’s move forwardand understand what is auto increment in SQL Auto increment keywordallows the users to create a unique number to get generated whenever a new recordis inserted into the table. So this keywordis usually required whenever primary key is used and auto increment keywordcan be only used in Oracle. Whereas the identity keywordcan be used in the SQL Server. So that was about Autoincremented sequel guys next. Let’s understand. What is a data warehousedata warehouse refers to a central repository of data where the data is assembledfrom multiple sources of information those dataare Consolidated transformed and made available for the mining as well as toonline processing Warehouse data also has a subset of datacalled the data Mass. So data warehousecan be understood as a central repository of data with the data is assembled frommultiple sources of information. So guys that wasabout data warehouse. Now, let’s move forwardand understand what are the different AuthenticationModes in SQL server and how it can be changed thedifferent authentication modes in SQL Server arebasically the windows mode and the mixed mode. So these two modesare basically used in SQL windows and to changethe authentication modes in SQL Server. What you can simply do isyou have to follow the steps that I’ve mentionedon the screen that is you haveto first click on start and go to programs and goto the Microsoft SQL server and click sequelEnterprise Manager to run SQL Enterprise Manager from the Microsoft SQL Serverprogram group now to change the authentication modesin the SQL Server, you can follow the stepsthat I’ve mentioned or the screen that is you have to clickon start go to programs go to Microsoft SQL server and click sequelEnterprise Manager to run SQL Enterprise Manager from the Microsoft SQLServer program group, then select the serverfrom the tools menu and select SQL Server configurationproperties and choose the security page, right? So that’s how you can changethe authentication mode in the SQL Server guys. Now, let’s move forwardwith the final question in the session that is what our stuff and replace function soAbout the stuff function first this function is basically usedto override existing characters or insert a stringinto another string. So the Syntax for this function is basically stuff stringexpression start length and the placement characters where the string expression is. Basically the string that will have characterssubstituted start represents the starting positionthe length refers to the numberof characters in The String which are substituted and the replacement spring carthe new characters which are injected in the spring comingto the replace function. This function is basicallyused to replace the existing charactersof all the occurrences. So the syntax forthis particular function is that replace spring expressionsearch string replacement spring where every search stringin the string expression will be replacedwith the replacement string. I hope I’m clearwith the staff function and the replace function. So Guys, these werethe top 65 questions that could be askedin your interviews. So guys if you have writtenin any interviews and you’ve been askedquestions related to SQL, please do let us knowin the comments section if you have any doubtsrelated Adams so that we clarified for you guys, so guys that’s an endfrom my side today. I hope you’ve gonethrough all the 65 questions and you’ve understood what kindof questions can be asked in your interviews. So if you’re preparing for an interview all the bestfor your interviews, so thank youand have a great day. I hope you have enjoyedlistening to this video. Please be kind enough to like it and you can comment anyof your doubts and queries and we will reply them at the earliest do look outfor more videos in our playlist And subscribe to Edurekachannel to learn more. Happy learning.