0% found this document useful (0 votes)
27 views5 pages

SQL

Uploaded by

d.chakol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
27 views5 pages

SQL

Uploaded by

d.chakol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
Genaral interview Questions. 1. What is DBMS? ‘A Database Management System (DBMS) is «program that contolscrestion maintenance and use of «database. DBMS can be temmed as File Manager that ‘manages data ina databace rather than saving tin Sle system, 2. Whatis RDBMS? [RDBMS stnds for Relational Database Management System, RDBMS store the data into the collection of ables, which is related by common fields bere the Columns ofthe table It also provides relational operator to manipulate the data stored into the tables. 3. Whatis SQL? SQL stand for Stucrzed Quary Language , audit used to communicate with the Database. This standard language wed to perf tks ouch a reuieval, ‘updstion, insertion and deletion of dat from a database 4, Whatis a Database? ‘Database is nothing but an organized frm of data for easy access, storing, etreval and managing of data. This is also mown as structured form of data which canbe aceseedinimany Ways 5. What are tables and Fields? ‘A tables set of dat that reorganized ina model with Columns aad Rows, Cokie ca be catgorized as vertical, and Rows are horizontal table has specified number of column called fields but can have any number of rows which is called record 6. Whatis a primary key? ‘A primary key is a combination of fields which uniquely specify a row: This i special kind of unique key, and it has implicit NOT NULL. constraint. It means, ‘umary key values cannot be NULL. 7. Whatis a unique key? ‘A Unique key conssnt uniquely identified each ecord inthe databace, This provides uniqueness forthe colin ost of coma. 8, Whatis aforeign key? ‘A foreign key is one table which canbe related tothe primary key of another table, Relationship neds tobe crested berveen to tables by referencing fore ‘ey with the primary ey of anther able 9. Whatis ajoin? ‘This is keyword used ro query data from more tables based on the relationship berveen the Helis ofthe ables. Keys playa major role when JOINS are used, 10. What are the types of and explain each? ‘There are various types of join which can be use to seieve data and it dapends onthe relationship between ables Inner Join nner join retum rows when there sat less one atch forts beeen the tables + Right Join. ‘Right join retum rows which are common berween the ables and allows of Right hand side table. Simply, i rerums all the rows from the ight hand side able even though there ae no matches inthe lft hand side abl. + Left Join. ‘Left join return rows which are common beta the tables and ll rows of Left hand side table, Simpy, itera ll the ros fom Left hand sida table even ‘though there are no matches in the Right hand side abe + Full Join. ‘Left joim return rows which are common beta the tables and allrows of Left hand side table, Simpy, itera ll the roe fom Left hand sida table even ‘hough there ae no matches in the Right hand side able. + Full Join. Full joi eta rors when there are matching rows im anyone ofthe ables. This menns, treurs al the rows oma the lft hand side table and all the rors font ‘the right hand side table 11, What is normaliza 2. 13. + First Normal Form (1NF) ‘Nonnalization ste process of minimizing redundancy and dependency by organizing elds and table ofa database, The main sim of Nomualization stad, delete or modify Held that canbe made ina sngle abe . What is Denormalization? ‘DeNonnalization isa technique used to access the data from higher to lower normal forms of database, Itis also process of introducing redundancy into a tuble ‘by incomporating data from the related tables. . What are all the different normalizations? ‘The nonnal forms can b divide ito 5 forms, andthe are explained below ‘This should remove al the duplicate cohims fom the table. Crestion of ables forthe relate data and dentition of nique columns + Second Normal Form (2NF): ‘Meeting all requirements ofthe first nomnal form. Placing the subses of data in separate tables and Creation of relationships between he tables using primary keys. + Third Normal Form (3NF): ‘This should meet ll equirements of NF. Removing the columns which are not dependent on primary key constants. + Fourth Normal Form (4NF): ‘Mestng all the requirements of third normal for and it should not have ml- valued dependencies 14, Whatis a View? ‘Acviewis a viral table which consists of subse of dita contained in a table. Views are not virally prevent, and takes less space to stor, View can have “ata of one or more ables combined, and itis depending on the rlationsip 15. Whatis an Index? An index is performance tuning method of lloving fster revival ofecord from the able. index cents an enty foreach value audit will be faster to teieve dat 16. Whats a Cursor? A database Cursor a contol which enables traversal over th ros or records inthe table, This canbe viewed asa pointer to one row ina set of rw. Casas ‘Yery much usefl for eaversing suchas revival, addition and removal of database records 17. Whatis a query? ADB query isa code written in order to get te information back fom the database. Query canbe designed in uch away that it matched with our expectation of ‘the result st. Simply, a question tothe Database, 18. Whats subquery? A subquary isa query within another query. The outer query is called as main query, and inner query is called subqury. SubQuary is always executed fst, and ‘the rest of subquey is passed onto the main query. 19. What are the types of subquery? There are two types of subquery ~ Correlated and Non-Coneated ‘A comated subquery camuot be considered as indapendent query, butt can refer the column in a table std in the FROM thelist ofthe main query. ‘A Non-Comelated sub query ean be considered as independent query andthe output of subquery are subsite in the main query. 20. Whatis a stored procedure? StoredProcedure is a function consists of many SQL statement o acces the database system, Several SQL statements are consolidate nto a sored procedure and execte thm whenever and wherever required 21, Whatis attrigger? ADB niggers a code or programs that automatically execute with response to some event on table or view in a database. Mainly, rigger helps to maintain the Inept of the database 22, Whatis the, ference between DELETE and TRUNCATE commands? DELETE command is used to remove rows fom the table, and WHERE clause ca be weed for conditional se of partmetrs Commit and Rollback can be performed aftr delete statement [TRUNCATE removes all ros from the table, Truncate operation cannot b rolled back, 23, What are local and global variables and their differences? ‘Local variables are she variable which canbe used or exis inside the function. They are not known the oher functions and those variables cannot be refered ‘or ised. Variables ea be created whenever tat faction i called (Goal variables are the variables which canbe used or exist throughout the program. Same variable declared in global cannot be used in functions. Global ‘rable cannot be cened whenever hat fiction called 24, What a constraint? CConsrint can be used to spaciy the Linit on the data ype of ble, Consrsnt can be specified wile cresting or altering the table statement. Sample of + NOT NULL. + CHECK, + DEFAULT. + UNIQUE. + PRIMARY KEY. + FOREIGN KEY. 25. Whats the difference between Cluster and Non-Cluster Index? Clustered index is used fr easy retieval of data from the database by altering the way thatthe records ae stored. Database sors out rows by the column which ‘asta be clustred inde ‘A nonclstered index does nt alter the way twas stored but crests a complete separate objet within the abe. It point back tothe original able rows afar ‘emching 26. Whatis Self-Join? Selfjoin is set tobe query used to compare to itself This is used to compare values ina columa with otber values inte same columa in he same table. ALIAS, ES canbe used forthe same table comparison 27. Whats Cross-Join? Cross jin defines as Cartesian product where number of ows inthe fst able mubipied by numberof rows inthe second ble. suppose, WHERE claus is ‘sed in cross jin then the query will work like an INNER JOIN, 28, Whats user defined functions? ‘User defined fonction are the fnctons writen o use tat logic whenever required. It isnot necessary to waite th same logic several times Instead, function canbe called or executed whenever needed. 29, What are all types of user defined functions? ‘Three types of user find functions are Sealar Functions. Inline Table valued functions. Multi statement valued functions. 30. Advantages and Disadvantages of Stored Procedure? Stored procedure canbe used asa modular programming — means crete once store and al for several times whenever required This supports faster execution ‘stead of steciting milaple querer, This reds natork traffic and provides better sect tothe dats, Disadvantage is that it canbe executed only in the Database and utilizes more memory inthe database server. 31. Whatiis Online Transaction Processing (OLTP)? 22, 23, 34, 35, 26. a7. a8, 29, 40. a1. a2. a. Online Transaction Processing (OLTP) manages transaction based applications Which canbe used for data entry, data etreval an data processing. OLTP makes eta management simple and efficient Unlike OLAP systems gal of OLTP systems is serving real-time transactions What is CLAUSE? SQL clause is defined to limit the result set by providing condition othe query. Ths usually ltrs some rows fom the whole set ofrecer What recursive stored procedure? A stored procedure which calls by itself uti it reaches some boundary condition. This recursive function or procedure helps programmers fous the same se of ‘ode any suber of tines What is Ui us and Interact commands? [UNION opertr is used to combine the results of two tables, anit liminates duplicate rows fom the tables [MINUS operator is used o ream rows from the frst query but not rom the second query. Matching records of fist and second query and other ros from the fst query wil be displayed asa result set, INTERSECT operators used to rerun rows retumed by both the queries What is an ALIAS command? ALIAS name canbe given oa table or column. This lis name canbe refered in WHERE clmse to ident the table or column. What is the ference between TRUNCATE and DROP statements? ‘TRUNCATE removes ll he rows from th able, and t cannot be rolled back, DROP command removes abe from th database and operation cannot be rolled back, What are aggregate and scalar functions? Aggregate functions are use to evaluate mathematical calculation and return single values. This canbe caleulted fom he columns in 2 able. Scalar functions eum a sng value based nthe pur value How can you create an empty table from an existing table? Select nt nudercopy fom sent where 1-2 How to fetch common records from two tables? Select tude from student INTERSECT Select student from Exam How tofetch alternate records from a table? To splay ever mumbes- Sete sien om (seco, de ons iden) hare adore 0 ‘To dalay odd aber Select tude from Select wn, student from student) where mod(owm, 2} How to select unique records from a table? ‘elect DISTINCT Studantio, tudanthame from Student What is the command used to fetch first 5 characters of the string? Select suBSTRING|studentName,,5) as studentname from student Select LeFTistudentname.) as studentrame from student Which operator is used in query for pattern matching? LIKE operators used for pater tein, adits bewsed as ‘Matches zero or tore characters 2. _(Underscore)~ Matching exactly one character select * from Stent wharestudentname ike!

You might also like