Sie sind auf Seite 1von 3

ingrNo

ingrName
ingrUnit
---------- ---------- ---------1
Tomato
whole
3
Olive oil millilitre
4
Mozzarella grams
7
Oregano
tablespoon
8
Basil
tablespoon
9
Rocket
tablespoon
11
Chorizo
grams
sqlite> SELECT * FROM Ingredient WHERE UPPER(ingrName) LIKE '%O%' UNION SELECT *
FROM Ingredient WHERE LOWER(ingrUnit) = 'tables
poons';
ingrNo
ingrName
ingrUnit
---------- ---------- ---------1
Tomato
whole
3
Olive oil millilitre
4
Mozzarella grams
7
Oregano
tablespoon
8
Basil
tablespoon
9
Rocket
tablespoon
11
Chorizo
grams
sqlite> SELECT * FROM Ingredient WHERE UPPER(ingrName) LIKE '%O%' UNION ALL SELE
CT * FROM Ingredient WHERE LOWER(ingrUnit) = 'ta
blespoons';
ingrNo
ingrName
ingrUnit
---------- ---------- ---------1
Tomato
whole
3
Olive oil millilitre
4
Mozzarella grams
7
Oregano
tablespoon
9
Rocket
tablespoon
11
Chorizo
grams
7
Oregano
tablespoon
8
Basil
tablespoon
9
Rocket
tablespoon
sqlite> SELECT * FROM Ingredient WHERE UPPER(ingrName) LIKE '%O%' INTERSECT SELE
CT * FROM Ingredient WHERE LOWER(ingrUnit) = 'ta
blespoons';
ingrNo
ingrName
ingrUnit
---------- ---------- ----------7
Oregano
tablespoons
9
Rocket
tablespoons
sqlite> SELECT * FROM Ingredient WHERE
FROM Ingredient WHERE LOWER(ingrUnit)
poons';
ingrNo
ingrName
ingrUnit
---------- ---------- ---------1
Tomato
whole
11
Chorizo
grams
sqlite> SELECT * FROM Ingredient WHERE
FROM Ingredient WHERE LOWER(ingrUnit)
poons';
ingrNo
ingrName
ingrUnit
---------- ---------- ---------1
Tomato
whole
7
Oregano
tablespoon
11
Chorizo
grams
sqlite> SELECT * FROM Ingredient WHERE
FROM Ingredient WHERE LOWER(ingrUnit)

UPPER(ingrName) LIKE '%O' EXCEPT SELECT *


= 'tables

UPPER(ingrName) LIKE '%O' EXCEPT SELECT *


= 'TAbles

UPPER(ingrName) LIKE '%O' EXCEPT SELECT *


= 'tables

poons';
ingrNo
ingrName
ingrUnit
---------- ---------- ---------1
Tomato
whole
11
Chorizo
grams
sqlite> CREATE VIEW EmployeeList AS SELECT empID, empFirstName
Name empName, roleName FROM Employee e, Role r W
HERE e.roleID = r.roleID;
sqlite> DROP VIEW EmployeeList;
sqlite> CREATE VIEW EmployeeList AS SELECT empID, empFirstName
Name empName, roleName FROM Employee e, Role r W
HERE e.roleID = r.roleID;
sqlite> VIEW EmployeeList;
Error: near "VIEW": syntax error
sqlite> .table
Address
Customer
Ingredient
Product
AddressType
Employee
OrderProduct
ProductSpecial
CustOrder
EmployeeList
OrderStatus
Recipe
sqlite> SELECT * FROM EmployeeList
...> ;
empID
empName
roleName
---------- --------------- ---------1
Classie Filkins Manager
2
Miesha Rozek
Chef
3
Amanda Corry
Cashier
4
Owen Willcutt
Cashier
5
Gary Zeledon
Delivery

|| ' ' || empLast

|| ' ' || empLast

Review
ReviewType
Role

sqlite> SJELECT empName, roleName FROM EmployeeList WHERE empName LIKE 'c%';
Error: near "SJELECT": syntax error
sqlite> SELECT empName, roleName FROM EmployeeList WHERE empName LIKE 'c%';
empName
roleName
--------------- ---------Classie Filkins Manager
sqlite> CREATE INDEX ind_empLastName ON Employee(empLastName);
sqlite> SELECT empLastName FROM Employee;
empLastName
----------Corry
Filkins
Rozek
Willcutt
Zeledon
sqlite> SELECT empLastName FROM Employee WHERE empLastName = 'Filkins';
empLastName
----------Filkins
sqlite> CREATE TABLE LOG(x);
sqlite>
sqlite> CREATE TRIGGER Product_insert_log AFTER INSERT ON Product
...> BEGIN
...> INSERT INTO LOG VALUES('insert product: new name= ' || new.prodName || '
on ' || DATETIME('now', 'localtime'));
...> END;
sqlite>
sqlite> DROP TRIGGER Product_insert_log;
sqlite>
sqlite> SELECT * FROM LOG;

sqlite> INSERT INTO Product(prodName, prodDesc) VALUES ('Johnny', 'Best Teacher'


);
sqlite> SELECT * FROM Product;
prodNo
prodName
prodDesc
prod
Price prodParentNo
---------- -------------- ---------------------------------------------- --------- -----------1001
Marinara D.O.C Tomatoes, E.V.O.O, oregano, garlic (no cheese) 20
1002
Regina Margher Tomato, E.V.O.O, fresh mozzarella di bufala, f 24
1003
La Bella Itali Tomato, E.V.O.O, fresh mozzarella di bufala, f 24
1004
Con Prosciutto Tomato, mozzarella, Italian cured ham, rocket, 24
1005
Chorizo Reale Tomato, mozzarella, chorizo
24
1006
Agilo
E.V.O.O, fresh garlic, rosemary, sea salt
15
2002
Regina Margher Tomato, E.V.O.O, fresh vegetarian rennet, fres 24
1002
2003
La Bella Itali Tomato, E.V.O.O, fresh vegetarian rennet, fres 24
1003
2004
Johnny
Best Teacher
sqlite> SELECT * FROM LOG;
sqlite>

Das könnte Ihnen auch gefallen