Podcast
Questions and Answers
What is SQL?
What is SQL?
SQL is a programming language designed to manage data in a relational database.
Which of the following are components of SQL?
Which of the following are components of SQL?
- SSL - Secure Sockets Layer
- DML - Data Manipulation Language (correct)
- DCL - Data Control Language (correct)
- DDL - Data Definition Language (correct)
T-SQL commands may vary slightly from ANSI-SQL.
T-SQL commands may vary slightly from ANSI-SQL.
True (A)
What is an example of a DDL statement?
What is an example of a DDL statement?
What does DML stand for?
What does DML stand for?
Which of the following is a common SQL data type for character strings?
Which of the following is a common SQL data type for character strings?
Which SQL statement is used to delete data?
Which SQL statement is used to delete data?
SQL commands are generally written in _______.
SQL commands are generally written in _______.
Match the following SQL commands to their functions:
Match the following SQL commands to their functions:
What does DCL stand for?
What does DCL stand for?
Flashcards are hidden until you start studying
Study Notes
Structured Query Language (SQL)
- SQL is a programming language designed to manage data in a relational database
- It uses simple declarative statements
- Standard, but with multiple versions and dialects
Components of SQL
- Data Definition Language (DDL)
- Creates, modifies, and deletes database structures
- Used to create tables, indexes, and views.
- Data Manipulation Language (DML)
- Used to retrieve, add, delete, and update data in tables
- Examples include INSERT, DELETE, UPDATE, and SELECT statements
- Data Control Language (DCL)
- Used to control access and permissions to the database
- Examples include GRANT and REVOKE statements
SQL Reserved Words
- There is a list of reserved words in SQL
- Comparison operators such as = (equal to) are commonly used
Common Data Types
-
Character Strings:
- char(n): Fixed-length string with consistent size
- varchar(n): Variable-length string with varying size
-
Exact Numerics:
- tinyint: Stores small integer values between 0 and 255.
- smallint: Stores integer values between -32,768 and 32,767.
- int: Stores larger integer values.
- bigint: Stores even larger integer values.
- decimal(p, s): Stores decimal numbers with specified precision (p) and scale (s).
-
Dates and Times:
- date: Stores dates in the format 'YYYY-MM-DD'.
Creating Tables
- Relational Schema Design:
- Focus on defining relationships between tables
- Identify primary keys (PKs) and foreign keys (FKs) to establish links
- Example:
EMPLOYEE
table stores employee information with columns likeenum
,ename
,salary
, andfloor
.PROJECT
table stores project details withpnum
,pname
, andleader
.WORKS_ON
table connects employees to projects.
SQL Style Guide
- Table Names and SQL Reserved Words:
- Use all uppercase letters, separate words with underscores (e.g., EMPLOYEE).
- Attribute Names:
- Use lowercase letters and underscores to separate words (e.g., ename).
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.