Links:
The SQL Playground initializes these variables for your use:
| $tb = $('#Data table'); | $tb is now a jQuery object that holds the table. |
| $tr = $('#Data table tr:has(td)'); | $tr holds all table rows except the header row. |
| $td = $('#Data table td'); | $td holds all table data elements. |
| $th = $('#Data table th'); | $th holds all table header elements. |
Note that you don't need to use document ready or its shorthand to work in the Playground.
I've extended jQuery's filter() method so that it accepts a regular expression, which will match against the text content of the elements.
Example:
| $td.filter(/^[t-u].+county$/i) .css('background', 'orange'); | Select all table data that start with the letter t or u and end with the word county
(case-insensitive), and give them an orange background.
You cannot accomplish this using contains(). |
Codecademy has a good SQL course. But it's based on SQLite, which has a slightly different syntax from Access, which we use in-house.
In Unit 2: Queries | 11. Limit, you'll see:
SELECT * FROM movies
ORDER BY imdb_rating DESC
LIMIT 3;
Note that Access does not have the LIMIT verb. Instead, you would use TOP, like this:
SELECT TOP 3 FROM movies
ORDER BY imdb_rating DESC;
In Unit 4: Multiple Tables | 4. Cross Join, you'll see:
SELECT
*
FROM
albums
JOIN artists ON
albums.artist_id = artists.id;
This is how you create an INNER JOIN in SQLite.
In Access, you have to explicitly include the word INNER:
SELECT
*
FROM
albums
INNER JOIN artists ON
albums.artist_id = artists.id;
This syntax also works in SQLite, so you might as well include the word INNER whenever you need an INNER JOIN.
select * from Co1516
select count(*) as Samples from So1516
select avg(P) as [Avg P], min(P) as [Min P], max(P) as [Max P], stdev(P) as [Stdev P] from An1516
select avg(P), min(P), max(P), stdev(P) from An1516
select round(avg(P), 2) as [Avg P] from An1516
select top 10 * from So1516 order by Lab
select top 10 * from So1516 order by Lab desc
select distinct Name from Pl1516
select * from Wa1516 where name like "%rick%"
select * from Pl1516 where Lab between 100 and 200 and Fe<40
select * from An1516 where County="059"
select * from An1516 where County in ("059", "139")
select CountyName, An1516.* from An1516
inner join County
on An1516.County=County.County
where An1516.County in ("059", "139")
select Name, count(*) as Samples from Pl1516
where Date
group by Name
having count(*) >= 20
order by 2 desc, Name
transform count(*)
select Report from (
select "FY11" as FY,Report from MI1011 where [Report] like "%gap%" union all
select "FY12" as FY,Report from MI1112 where [Report] like "%gap%" union all
select "FY13" as FY,Report from MI1213 where [Report] like "%gap%" union all
select "FY14" as FY,Report from MI1314 where [Report] like "%gap%" union all
select "FY15" as FY,Report from MI1415 where [Report] like "%gap%" union all
select "FY16 (to-date)" as FY,Report from MI1516 where [Report] like "%gap%"
)
group by Report
pivot FY
transform -sum(b.County is not null)
select CountyName
from County a
left join (
select "FY17 (to-date)" as FY,County from So1617 where field like "0%" union all
select "FY16" as FY,County from So1516 where field like "0%" union all
select "FY15" as FY,County from So1415 where field like "0%" union all
select "FY14" as FY,County from So1314 where field like "0%" union all
select "FY13" as FY,County from So1213 where field like "0%" union all
select "FY12" as FY,County from So1112 where field like "0%" union all
select "FY11" as FY,County from So1011 where field like "0%" union all
select "FY10" as FY,County from So0910 where field like "0%" union all
select "FY09" as FY,County from So0809 where field like "0%" union all
select "FY08" as FY,County from So0708 where field like "0%"
) b
on a.County=b.County
where b.County
group by CountyName
pivot FY