Week 4 Flashcards
What is Amazon RDS?
Amazon Relational Database is a web service that makes it easier to set up, operate, and scale a relational database within AWS cloud.
It provides cost efficient, resizable capacity for an industry standard relational database and manages common database administration tasks.
Why use RDS?
automates expensive and time consuming tasks such as managing backups, software patching, automatic failure detection, and recovery
What is SQL?
Structured Query Language.
A domain-specific language for working with certain databases called relational databases.
What is a relational database?
a type of database that stores information in tables - that is, the data is stored in rows and columns.
What is DDL?
Data Definition Language. These statements are utilized to define the database schema or skeleton. It is how we implement the design structure.
Main keywords in DDL?
CREATE.
ALTER
DROP
TRUNCATE
What does the CREATE keyword do? Which sub language is it used in?
It creates new objects or tables.
DDL
What does the ALTER keyword do? Which sub language is it used in?
It modifies existing objects or tables.
DDL
What does the DROP keyword do? Which sub language is it used in?
It deletes existing objects or tables.
DDL
What does the TRUNCATE keyword do? Which sub language is it used in?
It deletes all the data existing within a table leaving the skeleton of the table only.
DDL
Can changes be made to DDL operations?
No. DDL operations are permanent.
What is DML?
Data Manipulation Language statements are used to perform CRUD operations on the actual data. Operations are normally performed by row in a relational database.
What are the DML keywords?
INSERT.
UPDATE.
DELETE.
SELECT.
What does the INSERT keyword do? Which sub language is it used in?
It inserts a new row into a table.
DML
What does the UPDATE keyword do? Which sub language is it used in?
It updates one or more rows column values of a table that match a specific WHERE clause.
DML
What does the DELETE keyword do? Which sub language is it used in?
It deleetes one or more rows of a table that match a specific WHERE clause.
DML
What does the SELECT keyword do? Which sub language is it used in?
It obtains one or more rows of a table that match a specific WHERE clause. In ORACLE databases this is considered DML. This is how we perform queries in a database.
DML
What is DQL?
Data Query Language. A sub language where only the SELECT statement exists.
Four different DQL Clauses?
GROUP BY
HAVING
WHERE
ORDER BY
Explain the GROUP BY clause. Which sub language is it used in?
This will combine all rows by a column specified in a query and perform any aggregate functions which are stated.
DQL
Explain the HAVING clause. Which sub language is it used in?
This clause will pass another filter similar to the WHERE clause after everything has been filtered and grouped.
DQL
A SQL error will be thrown if you try to perform the ______ clause in a WHERE clause.
HAVING
What are Scalar Functions?
They operate on individual values and will perform some operation per row, and can be used in the SELECT or WHERE clause.
What are Aggregate Functions?
Aggregate functions operate on multiple values (multiple rows). These functions are used to combine (aggregate) the values existing in one column.
What does MAX(COLUMN) return? Which sub language is it used in?
It returns the max value on a column.
DQL
What does MIN(COLUMN) return? Which sub language is it used in?
It returns the minimum value on a column.
DQL
What does AVG(COLUMN) return? Which sub language is it used in?
It returns the average value of the column.
DQL
What does SUM(COLUMN) return? Which sub language is it used in?
It returns the sum of the column.
DQL
What does COUNT(COLUMN) return? Which sub language is it used in?
It returns the count of elements in a column.
DQL
Which clause can Aggregate functions be used within?
The SELECT clause.
What is DCL?
Data Control Language statements are used to manage the security and control of database systems.
What does the GRANT keyword do? Which sub language is it used in?
Grants any permission to an existing user.
DCL
What does the REVOKE keyword do? Which sub language is it used in?
Revokes any permissions of an existing user.
DCL
What is the TCL?
Transaction Control Language. These statements are utilized to manage transactions within a relational database.
What does the COMMIT keyword do? Which sub language is it used in?
Any DML operations that were executed before the statements will be persisted permanently.
TCL
What does the ROLLBACK keyword do? Which sub language is it used in?
Any DML operations between two COMMIT statments will be completely erased.
TCL
What does the SAVEPOINT keyword do? Which sub language is it used in?
Utilized to ROLLBACK to a specific point in time.
TCL
What is OWASP?
The Open Web Application Security Project is an international non-profit organization dedicated to Web Application Security.
What is insufficient logging and monitoring?
OWASP critical security issue.
Insufficient logging and monitoring is when you are missing security critical information logs or have a lack of proper log format, context, storage, security, and timely response to detect an incident or breach.
Define SELECT SQL Command.
Extracts data from a database.
Define UPDATE SQL Command.
Updates data in a database.
Define DELETE SQL Command.
Deletes data from a database.
Define INSERT INTO SQL Command.
Inserts new data into a database.
Define CREATE DATABASE SQL Command.
Creates new database.
Define ALTER DATABASE SQL Command.
Modifies a database.
Define CREATE TABLE SQL Command.
Creates a new table.
Define ALTER TABLE SQL Command.
Modifies a table.
Define DROP TABLE SQL Command.
Deletes a table.
Define CREATE INDEX SQL Command.
Creates an index (search key)
Define DROP INDEX SQL Command.
Deletes an index.
When should the producer produce data?
When the queue is not full.
When should the consumer consume data?
When the queue is not empty.
How can we solve the producer-consumer problem?
We can use the wait() and notify() methods to communicate between producer and consumer threads.
The wait() method to pause the producer or consumer thread depending on the queue size.
The notify() method sends a notification to the waiting thread.
What does I/O refer to?
The nature of how data is accessed, either by reading it form a resource (input) or writing it to a resource (output).
In Java, what are the two categories file I/O can fall into?
Streams.
Reader/Writer.
Explain Streams category.
Streams category is one of two categories relating to file I/O. Streams are for reading or writing bytes.
Explain Reader/Writer categories.
Reader/Writer category is one of two categories relating to file I/O. Reader/Writer are for reading or writing characters.
What does FileInputStream file I/O class do?
Reads raw bytes from a file.
What does FileOutputStream file I/O class do?
Writes raw bytes to a file.
What does FileReader file I/O class do?
Reads characters from a file.
What does FileWriter file I/O class do?
Writes characters to a file.
What does BufferedReader file I/O class do? What does it need?
Reads a file line by line, needs an instance of a FileReader with a path to the resource to be read in the constructor.
What does BufferedWriter file I/O class do? What does it need?
Writes to a file line by line, needs an instance of a FileWriter with a path to the destination file in the contructor.
What does Scanner file I/O class do?
Reads from an InputStream, useful methods for character reading.
What should you always close with when using I/O classes to read and write? Why?
.close()
This prevents exceptions from being thrown later, memory leaks, and system over utilization of unused resources.
What is Serialization?
The process of writing the state of an object to a byte stream; the reverse is called de-serialization.
What must an object do to be serialized?
It must implement the Serializable interface.
What is the point of a Marker interface?
The point is to provide metadata to the compiler.
How do you serialize an object?
To serialize an Object, you need a FileOutput Stream instance inside the constructor of an ObjectOutputStream, passing in the file path of where oyou want the Object to be serialized call the ObjectOutputStream.writeObject(yourObject) method.
How do you De-serialize an object?
To deserialize an Object, you need a FileInputStream instance inside the constructor of an ObjectInputStream, passing in the file path of where the serialized object is Call the ObjectInputStream.readObject() method, casting it to a bean of your type
What is a Singleton pattern ? Why is it useful?
A design pattern which allows the creation of an object in memory only once in an application and can be shared across multiple classes. It can be useful for services in an application, or other resources like a connection or thread pool.
The _______ is not created until it is used, often referred to as lazy instantiation.
Singleton
Which pattern gives the programmer complete control over instantiation?
Singleton Pattern.
How do you fetch the correct instance in a Singleton Pattern.
getInstance()
What allows coordination across a system due to the use of only 1 instance?
Singleton Pattern.