Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Concepts: Keywords #4747

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

Danielmnm1
Copy link

@Danielmnm1 Danielmnm1 commented Jun 4, 2024

Description

  • Added Concepts
  • Added Keywords
  • Added keywords.md describing the most important keywords in mysql and adding examples.

Issue Solved

Closes #4679

Type of Change

  • Adding a new entry
  • Updating the documentation

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@CLAassistant
Copy link

CLAassistant commented Jun 4, 2024

CLA assistant check
All committers have signed the CLA.

@letsbuildanything letsbuildanything self-assigned this Jun 4, 2024
@letsbuildanything letsbuildanything added new entry New entry or entries status: under review Issue or PR is currently being reviewed mysql MySQL labels Jun 4, 2024
Copy link
Collaborator

@letsbuildanything letsbuildanything left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Danielmnm1
I've requested some changes. Please take a moment to address them. If you have any concerns or reasons to reject specific suggestions, feel free to discuss them.
Also, Please refer to style-guide. It is a general guide to entry standards, which will help reduce the number of potential edits that will further need to be made to your PR.

@@ -0,0 +1,73 @@
---
Title: 'Keywords'
Description: 'MySQL keywords are predefined words that have special meaning in the SQL language. They are used to perform various operations within the database, such as creating tables, inserting data, querying the database, updating records, and more. Examples of MySQL keywords include SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, and ALTER.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description should be short, typically one sentence.

Tags:
- 'MySQL'
- 'Data'
CatalogContent: # Please use course/path landing page slugs, rather than linking to individual content items. If listing multiple items, please put the most relevant one first
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CatalogContent: # Please use course/path landing page slugs, rather than linking to individual content items. If listing multiple items, please put the most relevant one first
CatalogContent:

Comment on lines 12 to 13
- 'learn-example-course'
- 'paths/example-path'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 'learn-example-course'
- 'paths/example-path'
- 'learn-sql'
- 'paths/analyze-data-with-sql'
- 'paths/data-science'
- 'paths/data-science-foundations'

- 'learn-example-course'
- 'paths/example-path'
---
# MySQL Keywords
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# MySQL Keywords

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to include a title header. It is automatically provided by the metadata.

Keywords define the structure and syntax of SQL queries. They help organize the commands in a way that the MySQL database can interpret and execute. Each keyword performs a specific function such as selecting data (`SELECT`), inserting new records (`INSERT`), or modifying existing records (`UPDATE`).
Using keywords ensures that your SQL queries are standarized, this enhances readability and maintainability of your code.

### Example
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Danielmnm1,
Please add two separate sections: ##Syntax and ##Example.
In the Example section, include a table with a small number of rows and columns. like:

CREATE TABLE products (
    name VARCHAR(50),
    price DECIMAL(10, 2),
    quantity_in_stock INT
);

INSERT INTO products (name, price, quantity_in_stock) VALUES
('Product A', 19.99, 10),
('Product B', 5.99, 20),
('Product C', 49.99, 5);

INSERT INTO table_name (column1, column2) VALUES (value1, value2);
```

## Common Keywords
Copy link
Collaborator

@letsbuildanything letsbuildanything Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this section and include its content in the Example section.
Also, Please ensure the header and paragraph are separated by a line.

@letsbuildanything
Copy link
Collaborator

@Danielmnm1 It's been more than a week. Could you please make the requested changes as soon as possible?
Thanks!

@Danielmnm1 Danielmnm1 closed this Jun 22, 2024
@Danielmnm1 Danielmnm1 reopened this Jun 22, 2024
@Danielmnm1
Copy link
Author

I fixed the branch issue, please let me know your comments. Thank you.

@ishg-153
Copy link
Collaborator

@letsbuildanything Please check if your required changes are reflected.

Copy link
Collaborator

@letsbuildanything letsbuildanything left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Danielmnm1 I've requested some more changes. Please take a moment to address them. If you have any concerns or reasons to reject specific suggestions, feel free to discuss them.

Comment on lines +18 to +23
MySQL **keywords** are predefined words that have special meaning in the SQL language. They are used to perform various operations within the database, such as creating tables, inserting data, querying the database, updating records, and more. Examples of MySQL keywords include SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, and ALTER.

## Importance and Usage

Keywords define the structure and syntax of SQL queries. They help organize the commands in a way that the MySQL database can interpret and execute. Each keyword performs a specific function such as selecting data (`SELECT`), inserting new records (`INSERT`), or modifying existing records (`UPDATE`).
Using keywords ensures that your SQL queries are standarized, this enhances readability and maintainability of your code.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine and condense these statements. Remove the "Importance and Usage" section and ensure the whole statement is free of redundancy.

Keywords define the structure and syntax of SQL queries. They help organize the commands in a way that the MySQL database can interpret and execute. Each keyword performs a specific function such as selecting data (`SELECT`), inserting new records (`INSERT`), or modifying existing records (`UPDATE`).
Using keywords ensures that your SQL queries are standarized, this enhances readability and maintainability of your code.

## Syntax
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the entire Syntax section. I know I suggested adding it in the last review, and I apologize for any inconvenience this may cause.

Replace it with the following section:

Common MySQL Keywords

Here's a table of some commonly used MySQL keywords along with their definitions:

Keyword Definition
SELECT Retrieves data from one or more tables
FROM Specifies the table(s) to retrieve data from
WHERE Filters the results based on a condition
INSERT Adds new data into a table
UPDATE Modifies existing data in a table
DELETE Removes data from a table
CREATE Creates a new database object (e.g., table, index)
ALTER Modifies the structure of an existing database object
DROP Removes a database object
JOIN Combines rows from two or more tables
GROUP BY Groups rows that have the same values in specified columns
HAVING Specifies a search condition for a group or an aggregate
ORDER BY Sorts the result set in ascending or descending order
LIMIT Specifies the maximum number of rows to return in the result set
UNION Combines the result sets of two or more SELECT statements

Feel free to edit and improve as needed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the end, please refer to the official documentation of MySQL KEYWORDS for the comprehensive list.

Comment on lines +70 to +111
### CREATE

```SQL
CREATE TABLE employees (
id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
position VARCHAR(100),
salary DECIMAL(10, 2),
hire_date DATE
);
```

### INSERT

```SQL
INSERT INTO employees (first_name, last_name, position, salary, hire_date)
VALUES ('John', 'Doe', 'Software Engineer', 75000.00, '2024-05-25');
```

### SELECT

```SQL
SELECT first_name, last_name
FROM employees
WHERE position = 'Software Engineer';
```

### UPDATE

```SQL
UPDATE employees
SET salary = 80000.00
WHERE id = 1;
```

### DELETE

```SQL
DELETE FROM employees
WHERE id = 1;
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest combining the use cases of different keywords into one comprehensive example. Like this:

Example

The following example demonstrates the use of several MySQL keywords:

-- Create a new table
CREATE TABLE employees (
    id INT AUTO_INCREMENT PRIMARY KEY,
    first_name VARCHAR(50),
    last_name VARCHAR(50),
    position VARCHAR(100),
    salary DECIMAL(10, 2),
    hire_date DATE
);

-- Insert a new employee
INSERT INTO employees (first_name, last_name, position, salary, hire_date)
VALUES ('John', 'Doe', 'Software Engineer', 75000.00, '2024-05-25');

-- Select specific employees
SELECT first_name, last_name
FROM employees
WHERE position = 'Software Engineer';

- Feel free to edit and improve as needed.  
- Wherever possible, Please add the output section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Concept Entry] MySQL keywords
4 participants