modifying example scripts for SQLite3.

This commit is contained in:
Kazu Yamamoto 2014-12-10 16:18:07 +09:00
parent 06e054e91c
commit ca5bba45e3
5 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
#! /bin/bash
psql testdb -c "
sqlite3 test.db "
SELECT account_id, product_cd, cust_id, avail_balance
FROM LEARNINGSQL.account
FROM account
WHERE product_cd IN ('CHK', 'SAV', 'CD', 'MM')
;"

View File

@ -1,7 +1,7 @@
#! /bin/bash
psql testdb -c "
sqlite3 test.db "
SELECT e.fname, e.lname, d.name
FROM LEARNINGSQL.employee e INNER JOIN LEARNINGSQL.department d
FROM employee e INNER JOIN department d
USING (dept_id)
;"

View File

@ -1,7 +1,7 @@
#! /bin/bash
psql testdb -c "
sqlite3 test.db "
SELECT e.fname, e.lname, e_mgr.fname mgr_fname, e_mgr.lname mgr_lname
FROM LEARNINGSQL.employee e INNER JOIN LEARNINGSQL.employee e_mgr
FROM employee e INNER JOIN employee e_mgr
ON e.superior_emp_id = e_mgr.emp_id
;"

View File

@ -1,12 +1,12 @@
#! /bin/bash
psql testdb -c "
sqlite3 test.db "
SELECT emp_id, assigned_branch_id
FROM LEARNINGSQL.employee
FROM employee
WHERE title = 'Teller'
UNION
SELECT open_emp_id, open_branch_id
FROM LEARNINGSQL.account
FROM account
WHERE product_cd = 'SAV'
ORDER BY emp_id
;"

View File

@ -1,8 +1,8 @@
#! /bin/bash
psql testdb -c "
sqlite3 test.db "
SELECT open_emp_id, COUNT(*) how_many
FROM LEARNINGSQL.account
FROM account
GROUP BY open_emp_id
ORDER BY open_emp_id
;"