sql practice problems

Upload: jpatano

Post on 02-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 SQL Practice Problems

    1/5

  • 8/10/2019 SQL Practice Problems

    2/5

    11" >sing 2 ta'les list the *r#er%&$m'er *r#er%ate Part%&$m'erPart%escrition &$m'er%*r#ere# an# Q$ote#%Price

    1-" >sing 5 ta'les list the 0$stomerBs Last%&ame an# First%&ame followe# ', the*r#er%&$m'er Part%escrition an# &$m'er%*r#ere#"

    =================================================

    Answers

    Practice Exercises SQL (1)

    For the following exercises the collection name is: PREMIERE

    Selecting Attributes and Sorting

    1" Pro#$ce a list showing Part%&$m'er Part%escrition *n%+an# an# Pricesorte# ', Part%escrition"

    SELECT Part_Number, Part_Descr!t"#, $#_Ha#%, Prce

    &R$' PRE'EREP*RT

    $RDER B+ Part_Descr!t"#

    -" .e can re#$ce o$r shiing costs ', sorting ', /i%0o#e" Pro#$ce a listing that#oes this an# also shows the c$stomers name an# a##ress"

    SELECT !_C"%e, Last_Name, Street, Ct-, State

    &R$' PRE'ERECUST$'ER

    $RDER B+ !_C"%e

    2" Pro#$ce a list showing Part%&$m'er Part%escrition *n%+an# an# Price sorte#', .areho$se an# 0lass" In this case .areho$se is the ma3o$r sort 4e, an# 0lassis the minor sort 4e,"

    SELECT Part_Number, Part_Descr!t"#, $#_Ha#%, Prce

    &R$' PRE'EREP*RT

    $RDER B+ Ware."use, C/ass

  • 8/10/2019 SQL Practice Problems

    3/5

    Selecting Rows

    5" List all the attri'$tes in *RERLI&E (might 'e calle# *RER%P6R7) selectingonl, rows where the &$m'er%*r#ere# is greater than or e8$al to -"

    SELECT 0&R$' PRE'ERE$RDERLNE

    WHERE Number_$r%ere% = 2

    !" List all c$stomers Last%&ame an# First%&ame .hose 0re#it%Limit is less than ore8$al to 91"

    SELECT Last_Name, &rst_Name, Cre%t_Lmt

    &R$' PRE'ERECUST$'ER

    WHERE Cre%t_Lmt 3= 1444

    ;" List all c$stomers Last%&ame an# First%&ame .hose 0re#it%Limit is greater thanor e8$al to 91 an# whose /i%0o#e is 5

  • 8/10/2019 SQL Practice Problems

    4/5

  • 8/10/2019 SQL Practice Problems

    5/5