MySQL

Ace your homework & exams now with Quizwiz!

Backup

A backup is a copy of a database that is created to protect against data loss or corruption. MySQL provides several backup tools, including mysqldump and MySQL Enterprise Backup.

Database

A database is a collection of data that is organized and stored in a structured way. MySQL is a relational database management system, which means that it organizes data into tables that are related to each other by common fields.

Field

A field is a single piece of data that is stored in a table. Each field is associated with a specific column in the table.

Foreign Key

A foreign key is a field in a table that refers to the primary key of another table. Foreign keys are used to establish relationships between tables.

Join

A join is a query that combines data from two or more tables based on a common field. Joins are used to retrieve data from related tables.

Primary Key

A primary key is a unique identifier for a record in a table. Primary keys are used to ensure that each record in a table can be uniquely identified and accessed.

Query

A query is a request for data from a database. In MySQL, queries are written in SQL (Structured Query Language).

Stored Procedure

A stored procedure is a block of code that is stored in a database and can be executed by clients connecting to the database. Stored procedures can be used to encapsulate complex database operations and improve performance.

Table

A table is a collection of rows and columns that store data. In MySQL, tables are the primary way of organizing data in a database.

Transaction

A transaction is a set of database operations that are performed as a single unit. Transactions ensure that data is updated consistently and reliably.

Trigger

A trigger is a piece of code that is automatically executed by the database in response to a specific event. Triggers can be used to enforce data integrity rules or perform other tasks automatically.

View

A view is a virtual table that is created by a query. Views can be used to simplify complex queries, restrict access to sensitive data, or provide a more convenient interface to the data in a database.

Index

An index is a data structure that allows data to be accessed more quickly. In MySQL, indexes can be created on one or more fields in a table to speed up queries.

Replication

Replication is the process of copying data from one database to another. MySQL provides several replication features, including master-slave replication and multi-source replication.

INNER JOIN Query

This is the most common type of join in MySQL. It returns only the rows that have matching values in both tables being joined. For example, if you are joining a users table and an orders table on the user_id column, an inner join would return only the rows where there is a match between the user_id column in both tables.

JOIN Query

This query is used to combine data from two or more tables based on a common field. It takes the names of the tables to join, the columns to retrieve, and the join condition as arguments. For example, SELECT users.name, orders.order_number FROM users JOIN orders ON users.id = orders.user_id would retrieve the name column from the users table and the order_number column from the orders table, joined on the user_id column.

CREATE TABLE Query

This query is used to create a new table. It takes the name of the table and one or more column definitions as arguments. For example, CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), age INT) would create a new table called "users" with three columns: "id", "name", and "age".

DELETE Query

This query is used to delete data from a table. It takes the name of the table and one or more conditions that must be met to delete the data. For example, DELETE FROM users WHERE age < 18 would delete all records from the users table where the age column is less than 18.

GROUP BY Query

This query is used to group data by a specific column. It takes the name of the column to group by as an argument. For example, SELECT department, AVG(salary) FROM employees GROUP BY department would retrieve the average salary for each department in the employees table.

INSERT INTO Query

This query is used to insert new data into a table. It takes the name of the table and one or more column-value pairs as arguments. For example, INSERT INTO users (name, age) VALUES ("Alice", 25) would insert a new record into the users table with the name "Alice" and age 25.

LIMIT Query

This query is used to limit the number of rows returned by a query. It takes the number of rows to return as an argument. For example, SELECT name, age FROM users LIMIT 10 would retrieve the first 10 rows from the users table.

ALTER TABLE Query

This query is used to modify the structure of an existing table. It takes the name of the table and one or more column definitions as arguments. For example, ALTER TABLE users ADD email VARCHAR(255) would add a new column called "email" to the users table.

SELECT Query

This query is used to retrieve data from one or more tables. It takes one or more column names and table names as arguments. For example, SELECT name, age FROM users would retrieve the name and age columns from the users table.

ORDER BY Query

This query is used to sort data by a specific column. It takes the name of the column to sort by as an argument. For example, SELECT name, age FROM users ORDER BY age DESC would retrieve the name and age columns from the users table, sorted by age in descending order.

UPDATE Query

This query is used to update existing data in a table. It takes the name of the table, one or more column-value pairs to update, and one or more conditions that must be met to update the data. For example, UPDATE users SET age = 26 WHERE name = "Alice" would update the age column in the users table to 26 for the record with the name "Alice".

FULL OUTER JOIN Query

This type of join returns all the rows from both tables, along with any matching rows. If there is no match in one of the tables, the result will contain NULL values for the columns from that table. Full outer joins are not supported in MySQL, but can be emulated using a combination of left and right joins.

CROSS JOIN Query

This type of join returns the Cartesian product of the two tables being joined, meaning that it returns all possible combinations of rows from the two tables. Cross joins are less commonly used than other types of joins, but can be useful in certain cases.


Related study sets

Unit 10: Other Packaged Products

View Set

multiplicaciones/ multiplications

View Set

Chapter 23: Cardiovascular Alteration

View Set

8.5 Greatest Common Factor and Least Common Multiple

View Set

Cells: The Basic Units of Life: Tutorial

View Set