Computer Science > QUESTIONS & ANSWERS > SQL commands QUESTIONS AND ANSWERS (All)
AVG() ans: SELECT AVG(COLUMN NAME) FROM TABLE_NAME Using it in WHERE CLAUSE so a different form of presentation: TO LIST ONLY THOSE PRODUCTS AND PRICES WHERE THE AVERAGE IS MORE THAN A SPECIFIC AMO... UNT:- SELECT ProductName, Price FROM Products WHERE Price>(SELECT AVG(Price) FROM Products); COUNT() ans: SELECT COUNT(*) FROM TABLE_NAME (to select all the NON null values of records in the table SELECT COUNT(Column Name) FROM TABLE_NAME (to count all values in a column) SELECT COUNT(Distinct Column Name) FROM TABLE_NAME (to count all distinct values in a column) SELECT COUNT(Distinct Column Name) as NEWNAME FROM TABLE_NAME (to count all distinct values in a column and label the column with a new name) COUNT DISTINCT VALUES ans: SQL COUNT(DISTINCT column_name) Syntax SELECT COUNT(DISTINCT COLUMN NAME) FROM TABLE_NAME *** Distinct command doesn't work in MS access.Works in SQL and Oracle)*** FIRST() ans: To return the first value of a column. SELECT FIRST(column_name) FROM table_name; ***ONLY IN ACCESS*** Last() ans: To return the last value of a column SELECT LASt(column_name) FROM table_name; AGGREGATE FUNCTIONS ans: •AVG() - Returns the average value •COUNT() - Returns the number of rows •FIRST() - Returns the first value •LAST() - Returns the last value •MAX() - Returns the largest value •MIN() - Returns the smallest value •SUM() - Returns the sum Scalar Functions ans: •UCASE() - Converts a field to upper case •LCASE() - Converts a field to lower case •MID() - Extract characters from a text field •LEN() - Returns the length of a text field •ROUND() - Rounds a numeric field to the number of decimals specified •NOW() - Returns the current system date and time •FORMAT() - Formats how a field is to be displayed [Show More]
Last updated: 2 years ago
Preview 1 out of 13 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
May 23, 2022
Number of pages
13
Written in
This document has been written for:
Uploaded
May 23, 2022
Downloads
0
Views
90
In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·