Simple Database Queries Examples
Simple Database Queries Examples
This provides several examples of queries based on the concepts that have been discussed. The hour begins with the simplest query you can issue, and builds upon the initial query progressively. You use the EMPLOYEE_TBL table.
Selecting all records from a table and displaying all columns:
SELECT * FROM EMPLOYEE_TBL;
Selecting all records from a table and displaying a specified column:
FROM EMPLOYEE_TBL;
Selecting all records from a table and displaying a specified column. You can enter code on one line or use a carriage return as desired:
SELECT EMP_ID FROM EMPLOYEE_TBL;
Selecting all records from a table and displaying multiple columns separated by commas:
SELECT EMP ID, LAST_NAME FROM EMPLOYEE_TBL;
Displaying data for a given condition:
SELECT EMP ID, LAST_NAME FROM EMPLOYEE_TBL
WHERE EMP_ID = ‘333333333′;
Displaying data for a given condition and sorting the output:
SELECT EMP ID, LAST_NAME FROM EMPLOS-TE_TBL
WHERE CITY = ‘INDIANAPOLIS‘ ORDER BY EMP_ID;
Displaying data for a given condition and sorting the output on multiple columns, one column sorted in reverse order:
SELECT EMP ID, LAST_NAME
FROM EMPLOYEE_TBL
WHERE CITY = ‘INDIANAPOLIS‘ ORDER BY EMP_ID, LAST_NAME DESC;
Displaying data for a given condition and sorting the output using an integer in the place of the spelled-out column name:
SELECT EMP ID, LAST_NAME FROM EMPLOYEE_TBLWHERE CITY = ‘INDIANAPOLIS‘ ORDER BY 1;
Displaying data for a given condition and sorting the output by multiple columns using integers, the order of the columns in the sort is different than their corresponding order after the SELECT keyword:
SELECT EMP_ID, LAST_NAME
FROM EMPLOYEE_TBL
WHERE CITY = ‘ INDIANAPOLIS‘
ORDER BY 2, 1;
The ultimate solution to solve the headache of finding Databases Products Wholesale, Wi-Fi Audio Surveillance, Drop Ship Server Computers, HDD Media Player, SQL Fundamentals LiveLessons Special, MySQL - 4th Edition, Computer Science Textbooks Drop Shipping, LED Globes, Blogging & Internet Surfing Wholesale List, Sams Teach Yourself SQL in Accessories and Other Blogging and Internet Softwares Wholesale List trusty wholesaling supplies is get wholesaling drop shipper, no more headache of buying wholesale category.
Possibly related posts: (automatically generated)
Simple Database Queries Examples
- Using the New Wizards in SQL Server 2000
- Creating Enhanced Indexes
- Primary, Secondary, and Caching-Only Name Servers
- Audit Management continue...
- What Is Contained in the System Catalog?
- Network and Servers Technical Compare continue...
- Data Warehouse, Databases Easy Access Top ten Considerations part 2
- Key Differences Between Unix/Linux and NetWare continue...
- Keeping Multiple Database Applications in Sync with Replication
- The Active Directory Service and Windows Server 2003
- April 11th

It is creating a new model for web services.” "e; end interfaces and enterprise applications. … Web Interface Design
Roche also offer a complete range of web hosting services from shared and reseller hosting plans all the way up to fully managed dedicated servers and clusters. … Web Hosting Plan
The journal provides in-depth coverage of Microsoft SQL Server in all its flavours, from the scaled down to Embedded SQL Server and SQL Server for Windows CE to the desktop version of MSDE. … Database Design