Logo
Pattern

Discover published sets by community

Explore tens of thousands of sets crafted by our community.

Basic SQL Commands

15

Flashcards

0/15

Still learning
StarStarStarStar

ALTER TABLE

StarStarStarStar

Changes the structure of an existing table. Example usage: ALTER TABLE users ADD COLUMN birthday DATE;

StarStarStarStar

DELETE

StarStarStarStar

Removes records from a table. Example usage: DELETE FROM users WHERE user_id=1;

StarStarStarStar

UNION

StarStarStarStar

Combines the result sets of two or more SELECT statements. Example usage: SELECT username FROM users UNION SELECT name FROM customers;

StarStarStarStar

CREATE TABLE

StarStarStarStar

Creates a new table in the database. Example usage: CREATE TABLE users (user_id INT PRIMARY KEY, username VARCHAR(50), email VARCHAR(50));

StarStarStarStar

INSERT INTO

StarStarStarStar

Adds new records to a table. Example usage: INSERT INTO users (username, email) VALUES ('newuser', 'newuser@example.com');

StarStarStarStar

HAVING

StarStarStarStar

Adds a condition to filter groups made by GROUP BY. Example usage: SELECT COUNT(user_id), country FROM users GROUP BY country HAVING COUNT(user_id) > 10;

StarStarStarStar

SELECT

StarStarStarStar

Retrieves data from a database. Example usage: SELECT * FROM users;

StarStarStarStar

GROUP BY

StarStarStarStar

Arranges identical data into groups. Example usage: SELECT COUNT(user_id), country FROM users GROUP BY country;

StarStarStarStar

UPDATE

StarStarStarStar

Modifies existing records in a table. Example usage: UPDATE users SET email='newemail@example.com' WHERE user_id=1;

StarStarStarStar

TRUNCATE TABLE

StarStarStarStar

Deletes the data inside a table, but not the table itself. Example usage: TRUNCATE TABLE users;

StarStarStarStar

ORDER BY

StarStarStarStar

Sorts the result set of a query. Example usage: SELECT * FROM users ORDER BY username ASC;

StarStarStarStar

JOIN

StarStarStarStar

Combines rows from two or more tables. Example usage: SELECT * FROM orders JOIN customers ON orders.customer_id = customers.customer_id;

StarStarStarStar

WHERE

StarStarStarStar

Specifies a condition for filtering the records returned. Example usage: SELECT * FROM users WHERE username='john_doe';

StarStarStarStar

INDEX

StarStarStarStar

Creates a database index on one or more columns. Example usage: CREATE INDEX idx_username ON users (username);

StarStarStarStar

DROP TABLE

StarStarStarStar

Deletes a table and its data from the database. Example usage: DROP TABLE users;

Know
0
Still learning
Click to flip
Know
0
Logo

© Hypatia.Tech. 2024 All rights reserved.