CH 2- Structured Query Flashcards

1
Q

Business intelligence systems (BI)

A
-information systems that assist managers
and other professionals:
–Assessment
–Analysis
–Planning
–Control
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Ad-Hoc Queries

A

-Questions that can be answered using database data
Example: “How many customers in Portland, Oregon, bought our green baseball cap?”

–Created by the user as needed, instead of programmed into an application

–Common in business

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

SQL as a sublanguage

A

SQL is not a full-featured programming
language.
–C, C#

  • SQL is a data sublanguage for creating and processing database data and metadata.
  • SQL programming is a critical skill.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

SQL Categories

A

1) Data definition language (DDL)
2) Data manipulation language (DML) statements

3)SQL/Persistent Stored Modules (SQL/PSM)
statements

4) Transaction control language (TCL) statements
5) Data control language (DCL) statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Data definition language (DDL)

A

Used for creating tables, relationships, and other structures

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Data manipulation language (DML)

A
Used for:
▪Queries – SQL SELECT statement
▪Inserting data – SQL INSERT statement
▪Modifying data – SQL UPDATE statement
▪Deleting data – SQL DELETE statemen
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

SQL/Persistent Stored Modules

SQL/PSM

A

-Add procedural programming capabilities
▪Variables
▪Control-of-flow statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Transaction control language (TCL)

A

-Used to mark transaction boundaries and

control transaction behavior

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Data control language (DCL)

A
Used to grant (or revoke) database
permissions to (from) users and groups
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

SQL SELECT Statement

A

The fundamental framework for an SQL
query is the SQL SELECT statement.

=Selects the name of the column wanted

–SELECT {ColumnName(s)}
–FROM {TableName(s)}
–WHERE {Condition(s)}

•All SQL statements end with a semicolon(;).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

SQL FROM Statement

A

–FROM {TableName(s)}

=on what tables are the columns we selected

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

SQL WHERE Statement

A

–WHERE {Condition(s)}

=Specify the criteria needed on the columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

SQL Asterisc (*)

A

-All the columns of the table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

SQL (DISTINCT) keyword

A
  • Added after SELECT and before the column name to erase all the extra copies associate to a term or name.
  • ONLY one from each, no repetitions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

SQL TOP {percentage} PERCENT statement

A

-Organizes all the data based on the established top percentage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

SQL ORDER BY Statement

A
  • sorts table rows from lowest to highest (ascendant)
  • can be specified to be Descendant

a) ASC (ascendant)
b) DESC (Descendent)

17
Q

Wildcards SQL

A

-Used after LIKE and NOT LIKE operator

                   types (caracteres, no numeros): 1) SQL underscore (-): Sustituir un solo caracter
 represents a single, unspecified character in a specific position in the character string.

    ej: Casa_ -> significa que puede buscar casa 1,2...
2)SQL percent sign (%): Sustituir varios caracteres
       represents any sequence of contiguous,
unspecified characters (including spaces) in a
specific position in the character string
        ej: 'Pete%' -> puede ser Pete con cualquier apellido
18
Q

Null operator

A

-Determinar si hay valores ausentes o no los hay
( IS NULL)

*Si está vacio significa que no fue incluido en el catalogo

19
Q

SQL IN Operator

A
  • Put after WHERE statement.

IN= is equal to one of a set of values

20
Q

Aggregate functions

A
Put after SELECT function and with parenthesis the title
   SELECT       SUM (   )              AS      New Table

11

21
Q

SQL Built-in Aggregate Functions

A

COUNT(*)= Count the number of rows in a table

COUNT ({Name}]= Count the number of rows in the table where column {Name} IS NOT NULL

SUM =Calculate the sum of all values (numeric columns only)

AVG =Calculate the average of all values (numeric columns only)

MIN =Calculate the minimum value of all values

MAX =Calculate the maximum value of all values

*aggregate functions operate
on columns.

22
Q

CONCAT (+)

A

-añadir un caracter o grupos de caracteres

23
Q

HAVING clause

A

-need to filter the result of an aggregate function.

*HAVING ES UN CRITERIO QUE SE LE APLICA AL
GRUPO