This project involves working with a MySQL database. The provided schema needs to be set up and queries run to achieve desired outputs.
- MySQL Server (download from MySQL official website)
- MySQL Workbench (optional but recommended for easier management and query execution)
- Go to the MySQL official download page.
- Download the MySQL Installer for Windows.
- Run the installer and follow the installation instructions.
- Select the "Server Only" option during installation.
- Choose the default server configuration or customize it according to your requirements.
- Set a strong root password and remember it as you will need it later.
- After installation, open MySQL Workbench.
- Click on
+
to add a new connection. - Set the connection name (e.g., "MySQL Localhost").
- Enter the hostname (
localhost
) and the port (3306
by default). - Enter the username (
root
) and the password you set during installation. - Test the connection to ensure everything is set up correctly, then click "OK".
- Open MySQL Workbench and connect to your MySQL server.
- Click on the
SQL
button to open a new query tab. - Copy the provided schema (see below) and paste it into the query editor.
- Run the query to create and populate the database.
-- Sample schema provided
CREATE DATABASE my_database;
USE my_database;
CREATE TABLE my_table (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO my_table (name) VALUES ('Sample Name 1'), ('Sample Name 2');
- Open MySQL Workbench and connect to your database.
- Click on the
SQL
button to open a new query tab. - Write or paste the query you need to run.
- Execute the query by clicking on the lightning bolt icon or pressing
Ctrl+Enter
.
SELECT * FROM my_table;
After running the queries, you should see the expected output in the result grid below the query editor.
- Ensure MySQL Server is running if you encounter connection issues.
- Verify the root password and other connection details if you cannot connect.
- Check for syntax errors in your SQL queries.
Additional Resources