Database Flashcards
(70 cards)
What is a Primary Key?
A primary key is a unique identifier for a record within a database table.
It ensures that each record in a table can be uniquely identified. Typically, a primary key is composed of one or more columns in the table.
What is a Foreign Key?
A foreign key is a column or a set of columns in one table that references the primary key columns in another table. It establishes a link between two tables and enforces
referential integrity, ensuring that relationships between tables remain consistent.
What is a Composite Key?
A composite key is a key that consists of multiple columns, used together to uniquely identify records within a table.
It’s essentially a combination of two or more columns that together form a unique identifier.
Multipe Unique columns
What is a Unique Key?
A unique key is similar to a primary key in that it enforces uniqueness
constraint on a set of columns in a table. However, unlike a primary key, a table can have
multiple unique keys.
It can also be null
What is a Candidate Key?
A candidate key is a set of columns that can uniquely identify records within
a table.
From the candidate keys, one is chosen to be the primary key.
It can be a primary key
What is CGI?
Common Gateway Interface
CGI is a standard protocol that defines how web servers communicate with external programs
or scripts. It enables web servers to generate dynamic web pages by executing programs or
scripts on the server and sending the output to the client’s web browser.
CGI allows web servers to interact with databases, process form data, generate dynamic
content, and perform other tasks beyond serving static web pages.
Perl, Tcl, C or C++
executes programs on the server to process data to make the site dynamic
Whats the visual representation of CGI etc
Web browser to server
(HTTP Requests and Response)
Server to CGI Program
(CGI Gateway)
CGI Program to Database
(Query and Results)
What is the purpose of CGI?
While it’s primarily associated with generating web pages dynamically based on user input, it can also be used to handle form submissions, including sending emails.
How can CGI be used for sending emails?
- Form Submission: You start with an HTML form on your webpage where users can input their email address, subject, message, etc.
- Action Attribute: In the <form> tag of your HTML, you specify a URL for the form’s action attribute. This URL points to a CGI script on your server.
- CGI Script: On the server, the CGI script receives the form data submitted by the user. It typically runs some code (often written in languages like Perl, Python, or PHP) to process this data.
- Email Handling: Within the CGI script, you write code to take the form data and use it to compose an email message. This usually involves using a library or built-in functions provided by the programming language to send an email via SMTP (Simple Mail
Transfer Protocol). - SMTP Server: The CGI script communicates with an SMTP server (either running locally or remotely) to send the email. It connects to the server, authenticates if necessary, and then submits the email for delivery.
- Feedback to User: After the email is sent, the CGI script might generate a response page to let the user know that their message has been successfully sent or inform them
if there was an error.
What are some security considerations for CGI?
CGI scripts can introduce security vulnerabilities if not
implemented carefully. Common security risks include script injection, parameter manipulation,
and directory traversal attacks. Proper input validation, output encoding, and access control
measures are essential for securing CGI applications.
What is a database?
A database is a collection of related data
What is a DBMS?
A database management system is a system that enables users to create and maintain a database.
Oracle.
MySQL,
phpMyAdmin (MySQL,)
What is a database schema?
A database schema defines how data is organized within a database.
It is how u organize it example: with tables PKs etc
What are the 5 Components of a Database System
Data
Hardware
Software
Users
Data Access Language
What are the type of Users?
● Application Programmers: Develop software applications that interact with the
database.
● Online users: Access and manipulate data through interactive interfaces or web
applications.
● End users: Retrieve and analyze data to support decision-making and operational
activities.
● Database Administrators: Manage and maintain the database system, including tasks
such as performance tuning, security management, backup and recovery, and schema
evolution.
What are some examples of Database Access Languages?
SQL, My Access, Oracle, etc
What are the 2 types of Database Languanges
Data Definition Language (DDL): Constructs the database schema. Example: CREATE
command.
CREATE, ALTER and DROP
Data Manipulation Language (DML): Accesses the database, providing statements for
retrieving, modifying, inserting, and deleting data. Example: INSERT command.
DDL is table manipulation and DML is data manipulation
What are Data Models?
Data models describe the structure of the database, including data types, relationships, and
constraints. They facilitate communication between users and database designers, helping to
understand the meaning of data and user requirements
u designing the database example using and ERD, Normalization
What are the Characteristics of Data Models?
Usability (User Friendly)
Scalability (Dynamic Expansion)
Maintainability (Comments and Documentation)
Standardization (Consistent format and variable names)
What is Usability?
User-friendly design ensures that the interface for submitting emails is intuitive and easy to understand.
This includes clear labels for form fields, helpful hints or instructions, and
appropriate error messages if something goes wrong.
Ease of modification allows for quick adjustments to the form layout or functionality without requiring extensive reworking of the underlying code.
This could involve separating the presentation layer (HTML/CSS) from the logic layer (CGI script), making it
easier to update one without affecting the other.
What is Scalability?
Adaptable to growth means the system can handle an increasing number of users without significant degradation in performance.
This might involve optimizing the CGI script’s code for efficiency, implementing caching mechanisms, or
scaling resources such as server hardware or network bandwidth.
Performance considerations ensure that even as the system scales up, response times
remain acceptable for users. This might involve load testing the email sending
functionality to identify bottlenecks and optimizing the code or infrastructure accordingly.
What is Maintainability?
Ease of maintenance is achieved through well-organized code with clear documentation
and comments. This makes it easier for developers to understand how the CGI script
works and make changes or fixes as needed.
Documentation should include explanations of the script’s purpose, how it interacts with
other components of the system, and any dependencies or requirements. Comments
within the code should clarify complex logic or algorithms, making it easier for future
developers to follow.
What is Standardization?
Consistent naming conventions ensure that variables, functions, and other elements
within the CGI script have clear and meaningful names. This makes the code easier to
read and understand, reducing the likelihood of errors or confusion.
Standardized data types help maintain consistency and compatibility across different
parts of the system. For example, using a consistent format for dates and times ensures
that data passed between the CGI script and other components (such as databases or
external APIs) is interpreted correctly.
What is Horizontal Scaling?
Horizontal scaling involves adding more machines or computers to a system to handle increased
load.
(Add More Computers)