SQL
Quiz yourself by thinking what should be in
each of the black spaces below before clicking
on it to display the answer.
Help!
|
|
||||
---|---|---|---|---|---|
show | SELECT <colName1>, <colName2> FROM <table name> WHERE <colNam3> = <param>
🗑
|
||||
AND/OR | show 🗑
|
||||
ORDER BY | show 🗑
|
||||
INSERT INTO _____ VALUES | show 🗑
|
||||
UPDATE _______ SET | show 🗑
|
||||
DELETE | show 🗑
|
||||
TOP | show 🗑
|
||||
LIKE | show 🗑
|
||||
% | show 🗑
|
||||
_ | show 🗑
|
||||
[^charlist] or [!charlist] | show 🗑
|
||||
show | SELECT * FROM Persons
WHERE LastName IN ('Hansen','Pettersen')
🗑
|
||||
BETWEEN | show 🗑
|
||||
show | For tables:
SELECT po.OrderID, p.LastName, p.FirstName
FROM Persons AS p,
Product_Orders AS po
WHERE p.LastName='Hansen' AND p.FirstName='Ola'
for columns:
SELECT column_name AS alias_name
FROM table_name
🗑
|
||||
JOIN or INNER JOIN | show 🗑
|
||||
show | SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
LEFT JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName
🗑
|
||||
RIGHT JOIN | show 🗑
|
||||
FULL JOIN | show 🗑
|
||||
UNION (only selects distinct values) | show 🗑
|
||||
UNION ALL | show 🗑
|
||||
show | SELECT column_name(s)
INTO new_table_name [IN externaldatabase]
FROM old_tablename
SELECT *
INTO Persons_Backup IN 'Backup.mdb'
FROM Persons
🗑
|
||||
show | CREATE DATABASE database_name
🗑
|
||||
CREATE TABLE | show 🗑
|
||||
show | -- can't update or add new records w/o having value for notnull constrained col, col has to have value
CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
🗑
|
||||
UNIQUE | show 🗑
|
||||
UNIQUE (multiple columns) | show 🗑
|
||||
UNIQUE (to add after table already created [alter] table) | show 🗑
|
||||
UNIQUE (to remove constraint) | show 🗑
|
||||
PRIMARY KEY | show 🗑
|
||||
PRIMARY KEY (multiple columns) | show 🗑
|
||||
show | ALTER TABLE Persons
ADD PRIMARY KEY (P_Id)
ALTER TABLE Persons
ADD CONSTRAINT pk_PersonID PRIMARY KEY (P_Id,LastName)
🗑
|
||||
show | ALTER TABLE Persons
DROP CONSTRAINT pk_PersonID
🗑
|
Review the information in the table. When you are ready to quiz yourself you can hide individual columns or the entire table. Then you can click on the empty cells to reveal the answer. Try to recall what will be displayed before clicking the empty cell.
To hide a column, click on the column name.
To hide the entire table, click on the "Hide All" button.
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.
To hide a column, click on the column name.
To hide the entire table, click on the "Hide All" button.
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.
Normal Size Small Size show me how
Normal Size Small Size show me how
Created by:
sjampana920
Popular Engineering sets