2.1: First Steps To Database Management: Handling Tables Flashcards
Give examples of the most popular relational database systems. Explain databases as a collection of tables. Use SQL, the Oracle SQL Developer software, and Oracle. Create SQL tables. Insert and modify records (called tuples) in a table. Devise simple queries on the basis of a single table. Learn how to connect remotely to CISE Oracle.
Databases are a collection of ___________
tables
Create a Table header (table schema) using DDL
create table Employee
(EmpId integer,
Name varchar(25) not null,
Birthdate date,
Salary numeric (8,2),
primary key (EmptId);
What do different relational database management systems share?
SQL and underlying data model
Create the table body (table instance) using the DML
insert into Employee
values (567, ‘Meyer’, date ‘1975-03-25’, 23000);
Update record using DML
update Employee set Salary = 37000 where EmpId = 456;
Show the employee table (syntax)
select *
from Employee
Example of a PROJECTION on a selected list of attributes
Show (only) the employee IDs and their salaries.
select EmpId, Salary
from Employee;
varchar(25)
variable character string
25 max characters allowed
not null (schema constraint)
cannot be empty
numeric(8,2)
numeric - type for decimal numbers
8 digits long max
2 decimal places
primary key (EmpId)
unique. 2 records cannot have the same primary key
*
Selects all fields to be shown
Example of a selection with a filter condition (together with projection)
Show the IDs and salaries of all employees whose alary exceeds $27000.
select EmpId, Salary
from Employee
where Salary > 27000;
select (queries)
Select fields to be considered,
* if all fields are to be considered
where (queries)
filter condition
ex. Salary > 27000