Misc MySQL SELECT Examples

SELECT - All columns

Return all columns.

SELECT 
   *  
FROM Courses

SELECT - Return first 10 rows

Run a SQL Select statement and limit the number of rows returned. Useful when you are not sure of how to limit the recordset to be returned and you only want to return a few rows to do some initial analysis.

SELECT 
  course_designater , 
  course_name       , 
  employee_inactivating 
FROM Courses
LIMIT 10 

SELECT - Count rows in table

Returns a count of the total number of rows in a table.

SELECT COUNT(*) from Courses

SELECT - Joining tables

Join two MySQL tables together.

SELECT 
       a.course_name                     , 
       b.class_start_date                , 
       b.class_end_date                          
 
FROM         courses a 
        JOIN classes b 
             ON  a.course_designater = b.course_designater_fk

WHERE a.course_name LIKE '%Perl%'
GO 

 


If you find this site useful and are a book buyer/reader...

You can support my site by clicking on one of the Links below to Abe books

By doing this, I will receive a small commision on your purchase and making your purchase will not cost you any more money than if you went directly the site yourself! 

Abe Books sells books at a fraction of the original cost. I have purchased many books from them originally cost $40.00 for as little as $5 to $10 dollars including shipping costs


Click on applicable icon to find books at Abe Books on ...

MySQL MySQL & Php

Abe Books is one of my affiliates. I only use affiliates that I also purchase products from. I love Abe books. If it is printed they likely have a copy. I have also included a generic link to Abe Books below.

Once on their site, you will find that they have a nice, easy to use search engine so to find what you are looking for.

Free Shipping 125x125

MySQL Examples Map

MySQL Examples

SQL DML

String Functions

Stored Procedures

SQL Views

SQL Table Basics













navTango.com free

75% of your donation

goes to charity.