Aliases in SQL and Sorting Tables with jQuery

March 9, 2016
Category: TIL
Tags: SQL and Javascript

Today I learned:

Aliases for Tables in SQL

In your FROM statements, you can give tables temporary aliases to make them easier to refer to throughout the rest of the query using AS:

SELECT o.OrderID, o.Total, m.MemberName
FROM Members AS m, Orders AS o
WHERE m.MemberName="John Smith" AND m.MemberID=o.MemberID
ORDER BY o.OrderID;

Sorting tables with jQuery

This Tablesorter jQuery plugin is nifty. It make sorting tables on the fly quick and easy. Tablesorter.com lays out all of the specs.

Lay out your table with <thead> and <tbody> tags, then tell tablesorter where to find your table:

$(document).ready(function() 
    { 
        $("#myTable").tablesorter(); 
    } 
); 

See it in action:

ID Name Age Skill
1 Jessica 31 SQL
2 Frank 68 TCL
3 Jason 12 jQuery
4 Tim 43 PHP

Find this post useful?

Buy me a coffeeBuy me a coffee