SQL Flashcards
1
Q
How to create table
A
CREATE TABLE tablename( MemberId CHAR(6), FirstName VARCHAR(30), InstructorID INT, PRIMARY KEY (MemberID) FOREIGN KEY (...) REFERENCES othertable(...));
2
Q
Define SQL Data Types
A
VARCHAR (n) CHAR (n) DATE INT BOOLEAN DECIMAL (n,n)
NOT NULL - cannot be empty
3
Q
Define SQL
A
Structured Query Language
4
Q
SQL Syntax
A
SELECT … , … FROM Table
WHERE name = ‘John’;
5
Q
SQL Order
A
ORDER BY …;
Auto Ascending
ORDER BY … DESC;
6
Q
SQL Operators
A
= Equal to
<> Not Equal to
7
Q
SQL KeyWords
A
WHERE ... IN ' ' WHERE ... NOT IN ' ' WHERE ... BETWEEN ... AND ... WHERE ... IS NULL WHERE ... LIKE ...%
% - zero, one, multiple characters
_ - single character
8
Q
SQL Join Tables
A
SELECT Member.__, Job.___ FROM Member, Job
WHERE Member…. = Job….
9
Q
SQL Insert Into
A
INSERT INTO table(…, …)
VALUES(…, …)
IV
10
Q
SQL Update
A
UPDATE table
SET Fee = 25
WHERE … = ‘ ‘;
USW
11
Q
SQL Delete
A
DELETE FROM table
WHERE …;