Viva Cs
Viva Cs
MY SQL
VIVAQUESTIONS
1. WhatisDDLandDML?
DDL(DataDefinitionLanguage):Allthecommandswhichareusedtocre
ate, destroy, or restructure databases and tables come under this
category. Examples of DDL commands are - CREATE, DROP, ALTER.
DML (Data Manipulation Language): All the commands which are
used to manipulate data within tables come under this category.
Examples of DML commands are - INSERT, UPDATE, DELETE.
2. WhatisRDBMS?
RDBMS: A DBMS used to manage Relational Databases is called an
RDBMS (Relational Data Base Management System). Some popular
RDBMS software available are: Oracle, MySQL, Sybase, Ingress.
3. Whatisdata inconsistency?
Datainconsistencyoccurswhensamedatapresentintwodifferenttablesdo
esnot match.
4. Whatisarelation?
Relation/Table: A table refers to a two-dimensional representation of
data
arrangedincolumns(alsocalledfieldsorattributes)androws(alsocalledrec
ords or tuples).
5. Whatiscardinalityanddegree?
Cardinality:Totalnumberofrowsinatableiscalledthecardinalityofthetab
le. Arity/Degree: Total number of columns of a table is called the
Degree of the table.
7. Whatisselectionandprojection?
1
MySQL|VineetaGarg
8. Whatarethedifferenttypesofclausesusedin wherecommand?
CLAUSE/KEYWORD USAGE
DISTINCT Usedtodisplaydistinctvalues(removes
duplicatevalues)fromacolumnofatable.
WHERE Usedtospecifytheconditionbasedon
which rows of a table are displayed.
ORDERBY Usedtodisplaytheselectedrowsinascending
or in descending order of the specified
column/expression.
2
MySQL|VineetaGarg
9. Whatisacartesian product?
Cartesianproductoftwotablesisatableobtainedbypairingeachrowofonet
able with each row of another table. The table obtained has
columns=sumofthecolumnsofboththetables
rows=productoftherowsofboththetables It
is represented by the symbol X.
10. WhatisaUNION?
Union of two tables is a table in which the number of columns is same
as the
numberofcolumnsofthetwotablesandnumberofrowsisthesumofthenum
ber of rows of both the tables.
Unionoperationcanbeappliedontwotablesonlyifthetableshavesamenum
ber and type of columns.
11. Giveacommandtoinsertanewcolumnintoatable?Altertable
13. Giveacommandtodeletearowfromatable?Deletefrom
14. Giveacommandtoinsertanewrowintoatable?Insertinto
17. Whathappenswhenthedroptablecommandis
executed?
Alltherecordsaswellastheentirestructureofthetableisdeleted.
19. Whatareaggregatefunctions?
Aggregatefunctionsworkonmultiplerows.Thereare5typesofaggregate
functions:
Aggregatefunction Purpose
3
MySQL|VineetaGarg
MAX() Tofindthemaximumvalueunder
the specified column
4
MySQL|VineetaGarg
MIN() Tofindtheminimumvalueunder
the specified column
AVG() To find the average of values
under the specified column
SUM() To find the sum of values under
the specified column
COUNT() Tocountthevaluesunderthespeci
fied column
22. Whatisthedifferencebetweenwhere&having?
5
MySQL|VineetaGarg
deptno
doesnotbelongtodepttableiewecannotwritedeptnoinemptablewhichdoe
s not exist in dept table.