Chapter 1 - Intro to Relational Databases and SQL Flashcards

1
Q

What is a stored procedure?

A

A set of one or more SQL statements that are stored together in a database.

A user will create a stored procedure by using the CREATE PROCEDURE statement, name the procedure then provide the SQL code telling the database what to do. To execute this program later, the user will utilize the EXEC statement.

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

What is a trigger?

A

A special type of stored procedure that’s automatically when an insert, update, or delete operation is executed on a table or when a DDL statement is executed on a database.
These are used most often to validate data before a row is added or updated, but can also be used to maintain the relationships bt tables or to provide info about changes to the definition of a database.

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

What two data access models can be used to work with data in a SQL server?

A

1) For a .NET application, which can be written in Visual Basic, C#, C++, or F#, that model is typically ADO.NET.
2) For a Java application, that model is typically JDBC (Java Database Connectivity). Unlike ADO.NET, JDBC requires additional software, called a driver to communicate with SQL server.

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

What is Disconnected data architecture?

A

Architecture used by ADO.NET in which data retrieved from a database can be accessed even after the connection is closed.

ADO.NET accomplishes this by utilizing a DataSet, which is an in-memory data store that can hold multiple tables at the same time.

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

What are the basic ADO.NET objects in a .NET application used to retrieve data? What is the flow among these objects?

A

To retrieve data from a database you:

1) execute a command object that contains a SELECT statement
2) The command object uses a connection object to connect to the database and retrieve the data
3) You read the results one row at a time using the data reader object

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

What is a data provider?

A

Provides the classes that let you create the objects that you use to retrieve data from a database and to store data to a database.

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

What are the three hardware components of a Client/Server system?

A

Client – Web browser
Server – SQL Server 2012 database engine
Network – TCP/IP

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

What is LAN?

A

Local area connection, a simple client and server system

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

What is WAN?

A

Wide area network, two or more LANs connected as part of a larger network

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

What is an enterprise system?

A

CIient/server system and mainframe system in dispersed geographical locations

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

How does an application communicate with the database management system (DBMS)?

A

The application software communicates with the DBMS by sending SQL queries through the data access API.

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

In a file handling system, all the processing is done on what hardware component?

A

In a file handling system, all processing is done on the clients

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

How do web applications work? Describe the flow from web browser on a client.

A
  • A web browser on a client sends a request to a web server.
  • The web server processes the request.
  • The web server passes any requests for data to the database server.
  • The database server returns the results to the web server.
  • The web server returns a response to the browser.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the difference b/t a column and a row?

A

Column – represents some attribute of the entity

Row – contains a set of values for a single instance of the entity

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

What is a composite primary key?

A

A primary key consists of two or more columns

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

What is the difference b/t a primary key and a non-primary key?

A

Primary key – one or more columns that uniquely identify each row in the table (only one per table allowed. No nulls allowed)
Non-primary key (unique key) – makes each row unique. Can have many per table. Nulls allowed.

17
Q

What is an index? What does it do?

A

Provides an efficient way of accessing the rows in a table based on the values in one or more columns.

18
Q

What is a foreign key?

A

One or more columns in a table that refer to a primary key in another table.

19
Q

Describe a one-to-many relationship?

A

e.g. Department vs Employee. Each row in a table relates to one or more rows in another table.

20
Q

Describe a one-to-one relationship?

A

e.g. PC vs motherboard. If a table has a one-to-one relationship with another table, the data in the two tables could be stored in a single table.

21
Q

What is a many-to-many relationship?

A

e.g. students vs courses. It usually can be broken down into two one-to-many relationships.

22
Q

What is an identity column?

A

An identity column is a numeric column whose value is generated automatically when a row is added to the table.

23
Q

What are DLM statements?

A
DML (data manipulation language) Statements
SELECT
INSERT
UPDATE
DELETE
24
Q

What are DDL statements?

A

DDL (data definition language) Statements
CREATE DATABASE, TABLE, INDEX
ALTER TABLE, INDEX
DROP DATABASE, TABLE, INDEX