Lab 3
Lab 3
Step-2:TocreateanewDatabase.
Command—-> ‘createdatabasedbms_name;’
Step-3:Openadatabase.
Command—-> ‘usedbms_name;’
Step-7:Toseealltablesindatabase.
Step-8: The ORDER BY keyword is used to sort the result-set in ascending or descending
order.The ORDER BY keyword sorts the records in ascending order by default. To sort the
records in descending order, use the DESC keyword.
Command —-> ‘SELECTcolumn1,column2,...
FROMtable_name
ORDERBYcolumn1,column2,...ASC|DESC;’
TheLIMITclauseisusedtospecifythenumberofrecordstoreturn.TheLIMITclauseisusefulon large
tables with thousands of records. Returning a large number of records can impact performance.
Command —-> ‘SELECTcolumn_name(s)
FROMtable_name
WHERE condition
LIMIT number; ’
Step9: TheOFFSET keywordhelp to startlimit afterthat primary key.
Step-10:TheSELECTDISTINCTstatementisusedtoreturnonlydistinct(different)values.
Command —-> ‘SELECTDISTINCTCountryFROMCustomers;’
Step-11:Thesymbol<>inMySQLissameasnotequaltooperator(!=).
Step-12:ThenotinMySQLisusedtooppositeofthatcommand.
Step-13:TheBETWEENoperatorselectsvalueswithinagivenrange.Thevaluescanbe
numbers,text,ordates.TheBETWEENoperatorisinclusive:beginandendvaluesareincluded.