sql servcer interview questions

Upload: bin33

Post on 07-Apr-2018

237 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 SQL Servcer Interview Questions

    1/47

    ABSRow-level function

    that returns anabsolute value.

    ALTER COLUMNCommand used to

    change a column'ssize or type in atable.

    ALTER TABLECommand used tomodify a table'sdefinition.

    ANDLogical operatorthat, when used ina WHEREclause,

  • 8/6/2019 SQL Servcer Interview Questions

    2/47

    means that bothcriteria have to be

    met for a row to beincluded in theresult set.

    ASC

    Function used inORDER BY to put aSQL result set inascending order.

    AVGAggregate functionused to average agroup of rowvalues.

    BETWEENAn operator used to

  • 8/6/2019 SQL Servcer Interview Questions

    3/47

    determine whethera value occurs

    within a givenrange of values(inclusive); usedwith a WHEREclause.

    BIGINTInteger data typethat can storenumbers from -263to 263 - 1.

    BINARYData type used tostore strings of bits.

    BITData type that

  • 8/6/2019 SQL Servcer Interview Questions

    4/47

    consumes only asingle bit of

    storage.

    CASTConversion functionused to change a

    data type of acolumn within aquery.

    CEILINGRow-level functionthat returns thenext larger integer.

    CHAR(size)Character data typeused when thecolumn length is

  • 8/6/2019 SQL Servcer Interview Questions

    5/47

    known andunvarying.

    CHARACTERData type used tostore anycombination of

    letters, numbers,and symbols.

    CHARINDEXString function thatreturns the startingposition of aspecified pattern.

    CHECKIntegrity constraintused to createbounds for a

  • 8/6/2019 SQL Servcer Interview Questions

    6/47

    column value.

    CONSTRAINTSRestrictions thatcan be placed onvalues whencreating database

    objects such astables and views.

    CONVERTConversion functionused to explicitlyconvert to a givendata type within ina query.

    COUNT(*)Function used tocount the total

  • 8/6/2019 SQL Servcer Interview Questions

    7/47

    number of rows in aresult set.

    COUNT(attribute)Group function thatcounts the numberof rows where

    attribute is notNULL.

    CREATE INDEXCommand used tocreate an index.

    CREATE DATABASECommand used tocreate a database.

    CREATE SYNONYMCommand used to

  • 8/6/2019 SQL Servcer Interview Questions

    8/47

    create a synonym.

    CREATE TABLECommand used tocreate a table.

    CREATE VIEW

    Command used tocreate a view.

    CROSS JOINA query option usedto generate aCartesian product.

    DATEOracle equivalent ofDATETIME .

    DATEADD

  • 8/6/2019 SQL Servcer Interview Questions

    9/47

    Date function thatadds to a specified

    part of a date.

    DATEDIFFDate function thatreturns the

    difference betweentwo dates.

    DATEFORMATDate function thatcontrols how SQLServer interpretsdate constants thatare entered fordates.

    DATEPARTDate function that

  • 8/6/2019 SQL Servcer Interview Questions

    10/47

    returns thespecified part of the

    date requested.

    DATETIMEData type that canbe used for dates.

    DAYDate function thatextracts a day froma date.

    DECData type; synonymfor DECIMAL datatype.

    DECIMALNumeric data type

  • 8/6/2019 SQL Servcer Interview Questions

    11/47

    whose storage typevaries based on a

    specified precision.

    DECLARECommand used tocreate variables on

    the fly within ascript.

    DELETE FROMCommand thatdeletes rows in atable that maysatisfy a givencondition.

    DESCFunction used inORDER BY to put a

  • 8/6/2019 SQL Servcer Interview Questions

    12/47

    SQL result set intodescending order.

    DISTINCTResult set functionthat omits rows thatcontain duplicate

    data.

    DROP COLUMNCommand used todelete a column ina table.

    DROP CONSTRAINTCommand used todelete a namedconstraint.

    DROP INDEX

  • 8/6/2019 SQL Servcer Interview Questions

    13/47

    Command used todelete an index.

    DROP SYNONYMCommand used todelete a synonym.

    DROP TABLECommand used todelete a table.

    DROP VIEWCommand used todelete a view.

    EXISTSA keyword in a SQLstatement thatreturns true in aWHERE clause if

  • 8/6/2019 SQL Servcer Interview Questions

    14/47

    the subqueryfollowing it returns

    at least one row.

    FLOATDecimal data typethat has a precision

    of 15 digits.

    FLOORRow-level functionwhich returns thenext lower integervalue when anumber containsdecimal places.

    GEtdATEDate function thatreturns the current

  • 8/6/2019 SQL Servcer Interview Questions

    15/47

    system date andtime.

    GROUP BYProduces onesummary row forthe aggregate value

    of all values for agiven column.

    GUIDGlobal uniqueidentifier;UNIQUEIDENTIFIERdata typeguaranteesworldwideuniqueness, evenamongunconnected

  • 8/6/2019 SQL Servcer Interview Questions

    16/47

    computers.

    HAVINGPart of a SQLstatement that isused to determinewhich groups of a

    GROUP BY will beincluded in theresult set.

    IMAGELarge object binarydata type; used tostore pictures.

    INLogical operator fora WHERE clausethat tests for

  • 8/6/2019 SQL Servcer Interview Questions

    17/47

    inclusion in anamed set.

    INTInteger data typethat can storenumbers from -231

    to 231 - 1.

    INDEX BYCommand used tocreate an index ona table by a certaincolumn value.

    INNER JOINCommand used tocombine two tablesin an equi-joinoperation.

  • 8/6/2019 SQL Servcer Interview Questions

    18/47

    INSERT INTO..

    SELECTA way to insertmany rows into anew table at onetime.

    INSERTINTO..VALUES

    A way to insertvalues into a tableone row at a time.

    INSERTCommand thatallows for theaddition of newrows to a table.

  • 8/6/2019 SQL Servcer Interview Questions

    19/47

    INTEGERNumeric data type

    that has no digitsafter the decimalpoint.

    INTERSECT

    Set operation thatcombines twoqueries such that itreturns all rows thatare the same inboth result sets.

    IS NOT NULLFunction that testsfor the NOT NULLcondition.

    ISNULL

  • 8/6/2019 SQL Servcer Interview Questions

    20/47

    Function thatreturns a true value

    if a data itemcontains a null.

    JOINCommand used to

    join two tables;synonymous withINNER JOIN.

    LEFTString function thatreturns the leftportion of a stringup to a givennumber ofcharacters.

    LEFT JOIN

  • 8/6/2019 SQL Servcer Interview Questions

    21/47

    Same as LEFTOUTER JOIN .

    LEFT OUTER JOINA join where all therows from the first(left) table are kept

    in the result set,regardless ofwhether they havematching rows inthe second (right)table.

    LENString function thatreturns the lengthof a string.

    LIKE

  • 8/6/2019 SQL Servcer Interview Questions

    22/47

    A WHERE clauseoption that matches

    a particular pattern.

    LONGOracle equivalent ofTEXT data type.

    LOWERString function usedto convert a stringto lowercase.

    LTRIMString function thatremoves blanks orother namedcharacter from thebeginning of astring.

  • 8/6/2019 SQL Servcer Interview Questions

    23/47

    MAX

    Aggregate functionthat returns thehighest of all valuesfrom a column in aset of rows.

    MINAggregate functionthat returns thelowest of all valuesfrom a column in aset of rows.

    MINUSSet operation thatreturns only thoserows from theresult of the first

  • 8/6/2019 SQL Servcer Interview Questions

    24/47

    query that are notin the result of the

    second query; notavailable in SQLServer.

    MONEY

    Data type used withcurrency data.

    MONTHDate function thatextracts the monthfrom a date.

    NATIONALCHARACTER

    A data type;synonym forNCHAR data type.

  • 8/6/2019 SQL Servcer Interview Questions

    25/47

    NCHAR

    Fixed-lengthUnicode characterdata type.

    NOT

    Operator thatreverses the effectof any logicaloperator such asIN, LIKE, andEXISTS.

    NOT BETWEENOperator thatallows you todetermine whethera value does notoccur within a given

  • 8/6/2019 SQL Servcer Interview Questions

    26/47

    range of values.

    NOT EXISTSOperator thatreturns true in aWHERE clause ifthe subquery

    following it returnsno rows.

    NOT NULLOperator thatreturns true if anattribute has a non-null value.

    NOT NULLConstraintIntegrity constraintthat denies the

  • 8/6/2019 SQL Servcer Interview Questions

    27/47

    creation of a rowwhen an attribute

    has a null value.

    NULLValue that isunknown.

    NULLIFFunction thatreturns a NULL if acertain condition ismet in anexpression.

    NUMERICSynonym forDECIMAL data type.

    NVARCHAR

  • 8/6/2019 SQL Servcer Interview Questions

    28/47

    Variable-lengthUnicode character

    data type.

    ORBinary logicaloperator that

    returns a true valueif either one of theexpressions is true.

    ORDER BYClause that sortsthe results of aquery before theyare displayed.

    OUTER JOINJoin where rowsfrom a table are

  • 8/6/2019 SQL Servcer Interview Questions

    29/47

    kept in the resultset although there

    is no matching rowin the other tableused in the join.

    PERCENT

    Function that isused to return acertain percentageof records that fallat the top of arange specified.

    PRIMARY KEYConstraint used tocreate a primarykey in a table; usedin CREATE TABLEand ALTER TABLE

  • 8/6/2019 SQL Servcer Interview Questions

    30/47

    commands.

    REALDecimal data typethat has a precisionof seven digits.

    REFERENCESConstraint part thatdefines the tablename and key usedto referenceanother table.

    RIGHTString function thatreturns the rightportion of a string.

    RIGHT JOIN

  • 8/6/2019 SQL Servcer Interview Questions

    31/47

    Same as RIGHTOUTER JOIN .

    RIGHT OUTER JOINJoin where all therows from thesecond (right)

    relation are keptwhether matched ornot in a joinoperation.

    ROUNDFunction used toround numbers to aspecified number ofdecimal places.

    ROWCOUNT(n)Function that

  • 8/6/2019 SQL Servcer Interview Questions

    32/47

    returns the first nrows.

    RTRIMString function thatremoves blanksfrom the right end

    of a string.

    SELECTCommand thatallows you toretrieve rows fromtables (or views) ina database.

    SETCommand used toassign values tovariables.

  • 8/6/2019 SQL Servcer Interview Questions

    33/47

    SET DATEFORMAT

    Date function usedto change theformat in whichSQL Server reads indates.

    SMALLDATETIMEData type used tostore dates.

    SMALLINTInteger data typethat can storenumbers between -215 to 215 - 1.

    SMALLMONEYData type that can

  • 8/6/2019 SQL Servcer Interview Questions

    34/47

    be used withcurrency data.

    SQUARERow-level functionthat returns thesquare of a

    number.

    SQL_VARIANTData type used tostore values of anydata type exceptTEXT or IMAGE.

    SQRTRow-level functionthat returns thesquare root ofpositive numeric

  • 8/6/2019 SQL Servcer Interview Questions

    35/47

    values.

    STRConversion functionthat alwaysconverts from anumber to a

    character data type.

    SUBSTRINGString function thatreturns part of astring.

    SUMGroup function thatadds up all thevalues for a columnvalue in a set ofrows.

  • 8/6/2019 SQL Servcer Interview Questions

    36/47

    TABLE

    A two-dimensional(row by column)arrangement ofdata.

    TEXTCharacter largeobject data type.

    TINYINTInteger data typethat can storenumbers between 0and 255.

    TOPFunction thatreturns a specified

  • 8/6/2019 SQL Servcer Interview Questions

    37/47

    number of recordsfrom the top of a

    result set.

    UNIONSet operation thatcombines two

    queries such that itreturns all distinctrows for the resultsets of bothqueries. The twoqueries must haveunion-compatibleresult sets.

    UNION ALLSet operation thatcombines twoqueries and returns

  • 8/6/2019 SQL Servcer Interview Questions

    38/47

    all rows from boththe SELECT

    statements(queries). A UNION

    ALL also includesduplicate rows. Thetwo queries must

    have union-compatible resultsets.

    UNIQUEIntegrity constraintthat disallowsduplicate entries foran attribute eventhough the columnis not a primarykey.

  • 8/6/2019 SQL Servcer Interview Questions

    39/47

    UNIQUEIDENTIFIERData type that

    guaranteesuniqueness of theidentifier, evenamongunconnected

    computers.

    UPDATECommand thatchanges values inspecified columns inspecified tables .

    UPPERString function usedto display all outputin uppercase.

  • 8/6/2019 SQL Servcer Interview Questions

    40/47

    USECommand used to

    open a database.

    UUIDUniversal uniqueidentifier; the

    UNIQUEIDENTIFIERdata type thatguaranteesuniqueness, evenamongunconnectedcomputers.

    VARBINARYData type used tostore variable-length binary data.

  • 8/6/2019 SQL Servcer Interview Questions

    41/47

    VARCHAR

    Character data typeused when the fieldlength is varying.

    VARCHAR2

    Oracle equivalent ofVARCHAR.

    WHERERow filter part of aSQL statement thatallows you tospecify criteria oncolumn values forrows that are beingselected from atable.

  • 8/6/2019 SQL Servcer Interview Questions

    42/47

    WITH TIESClause used with

    the TOP function toretrieve rows thatare ties.

    XML

    A new SQL Serverdata type used tomodel complexdata.

    YEARDate function thatextracts the yearfrom a date.

    21-03-09, 09:08 #2 (permalink)

  • 8/6/2019 SQL Servcer Interview Questions

    43/47

    PM

    teja83Senior Member

    Join Date: Dec

    2008

    Posts: 221

    Miscellaneous

    SQL Server

    Objects

    y Synonyms

    A synonym isan alternative

    name for a

    schema-scoped

    object. It is asingle-partname to

    reference a

    base object. A

    synonym issimilar to an

    alias, but it

  • 8/6/2019 SQL Servcer Interview Questions

    44/47

    replaces a

    two-part,

    three-part, orfour-part

    name.

    y Databasediagrams

    A databasediagram is a

    graphical

    design of atable or set of

    tables that

    can be usedto illustrate

    the tables and

    relationshipswithin a

    database.

    y Statistics

  • 8/6/2019 SQL Servcer Interview Questions

    45/47

    Stored within

    a table,

    statistics areautomatically

    created andoptionally

    supplemented

    histograms.y AssembliesAn assembly

    references amanaged

    application

    module (DLLfile) that was

    created in the

    .NETFramework

    common

    language

  • 8/6/2019 SQL Servcer Interview Questions

    46/47

    runtime

    (CLR).y ProxiesIn the msdb

    context, aproxy defines

    security

    context andprovides the

    SQL Server

    Agent accessto credentials

    for a Windows

    user.

    Read more:

    http://www.placementpapers.us/sql_ser

    ver/905-

  • 8/6/2019 SQL Servcer Interview Questions

    47/47

    important_commands_functions_sql_ser

    ver_2005_a.html#ixzz1IGVh3Rn0

    Under Creative Commons License:

    Attribution