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

[New entry] PostgreSQL Identifiers #5338

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

Conversation

cigar-galaxy82
Copy link
Collaborator

@cigar-galaxy82 cigar-galaxy82 commented Sep 26, 2024

Description

Issue Solved

#4532

Type of Change

  • Adding a new entry

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.

@SaviDahegaonkar SaviDahegaonkar self-assigned this Sep 26, 2024
@SaviDahegaonkar SaviDahegaonkar added new entry New entry or entries postgresql PostgreSQL status: under review Issue or PR is currently being reviewed labels Sep 26, 2024
Copy link
Collaborator

@SaviDahegaonkar SaviDahegaonkar left a comment

Choose a reason for hiding this comment

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

Hey @cigar-galaxy82 ,
The entry LGTM. I have suggested a few changes please make them asap, so I can merge this PR.

@@ -0,0 +1,289 @@
---
Title: 'Identifier'
Description: 'Refers to the name given to databases object such as tables, columns, indexes, etc.'
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
Description: 'Refers to the name given to databases object such as tables, columns, indexes, etc.'
Description: 'Refers to the name given to database objects such as tables, columns, indexes, etc.'

- 'paths/analyze-data-with-sql'
---

In PostgreSQL, identifiers refer to the names given to database objects such as tables, columns, indexes, views, sequences, and other database components.
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
In PostgreSQL, identifiers refer to the names given to database objects such as tables, columns, indexes, views, sequences, and other database components.
In PostgreSQL, **Identifiers** refer to the names given to database objects such as tables, columns, indexes, views, sequences, and other database components.

First mention of the concept must be in bold.

Comment on lines 19 to 33
`Identifier Types` refers to names given to objects in a database like tables, columns, indexes, and other components of a database. These names help **PostgreSQL** to interact with the database. The are different types of Identifier that are used.

- Table Identifier
- Column Identifiers
- Index Identifiers
- View Identifiers
- Constraint Identifiers
- Schema Identifiers
- Sequence Identifiers
- Function Identifiers
- Trigger Identifiers
- Role Identifiers
- Foreign Key Identifiers
- Aggregate Type Identifiers
- Tablespace Identifiers
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
`Identifier Types` refers to names given to objects in a database like tables, columns, indexes, and other components of a database. These names help **PostgreSQL** to interact with the database. The are different types of Identifier that are used.
- Table Identifier
- Column Identifiers
- Index Identifiers
- View Identifiers
- Constraint Identifiers
- Schema Identifiers
- Sequence Identifiers
- Function Identifiers
- Trigger Identifiers
- Role Identifiers
- Foreign Key Identifiers
- Aggregate Type Identifiers
- Tablespace Identifiers
`Identifier Types` refers to names given to objects in a database like tables, columns, indexes, and other components of a database. These names help **PostgreSQL** to interact with the database. There are different types of identifiers that are used.
- Table Identifiers
- Column Identifiers
- Index Identifiers
- View Identifiers
- Constraint Identifiers
- Schema Identifiers
- Sequence Identifiers
- Function Identifiers
- Trigger Identifiers
- Role Identifiers
- Foreign Key Identifiers
- Aggregate Type Identifiers
- Tablespace Identifiers


### Table Identifier

Table Identifier refers to the name given to a table in the database. These names are used for interacting with the tables, they must follow certain rules like each table must have a unique name, using only characters in the name that are allowed, etc.
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
Table Identifier refers to the name given to a table in the database. These names are used for interacting with the tables, they must follow certain rules like each table must have a unique name, using only characters in the name that are allowed, etc.
A Table Identifier refers to the name given to a table in the database. These names are used for interacting with the tables, and must follow certain rules such as each table must have a unique name, using only characters in the name that are allowed, etc.


### Schema Identifiers

Schema Identifiers refers to name given to schemas, which are logical container for building relation between tables, views, indexes and other database objects. It helps in organizing database object and avoid conflicts.
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
Schema Identifiers refers to name given to schemas, which are logical container for building relation between tables, views, indexes and other database objects. It helps in organizing database object and avoid conflicts.
Schema Identifiers refer to names given to schemas, which are a logical container for building relations between tables, views, indexes, and other database objects. It helps organize database objects and avoid conflicts.

I rephrased the sentence for more clarity.


### Sequence Identifiers

Sequence Identifiers refer to names assigned to sequences which are used to generate unique integer values and can be used in scenarios when the purpose is to make sure each row has a distinct value, typically used for auto-incrementing primary key columns.
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
Sequence Identifiers refer to names assigned to sequences which are used to generate unique integer values and can be used in scenarios when the purpose is to make sure each row has a distinct value, typically used for auto-incrementing primary key columns.
Sequence Identifiers refer to names assigned to sequences that are used to generate unique integer values and can be used in scenarios when the purpose is to make sure each row has a distinct value, typically used for auto-incrementing primary key columns.


#### Example

In the below example a custom function `add_numbers` used to add numbers passed to it:
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
In the below example a custom function `add_numbers` used to add numbers passed to it:
In the below example a custom function `add_numbers` is used to add numbers passed to it:


### Role Identifiers

Role Identifiers refer to names given to roles which are used to manage roles within the database. They are fundamental parts of security and permission systems They can be used to give certain access to a user like reading all the tables, writing to all tables, etc.
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
Role Identifiers refer to names given to roles which are used to manage roles within the database. They are fundamental parts of security and permission systems They can be used to give certain access to a user like reading all the tables, writing to all tables, etc.
Role Identifiers refer to names given to roles that are used to manage roles within the database. They are fundamental parts of security and permission systems They can be used to give certain access to a user like reading all the tables, writing to all tables, etc.

Comment on lines +239 to +250
CREATE TABLE departments (
id SERIAL PRIMARY KEY,
name VARCHAR(100)
);

CREATE TABLE employees (
id SERIAL PRIMARY KEY,
name VARCHAR(100),
department_id INT,
CONSTRAINT fk_department FOREIGN KEY (department_id)
REFERENCES departments(id)
ON DELETE CASCADE
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
CREATE TABLE departments (
id SERIAL PRIMARY KEY,
name VARCHAR(100)
);
CREATE TABLE employees (
id SERIAL PRIMARY KEY,
name VARCHAR(100),
department_id INT,
CONSTRAINT fk_department FOREIGN KEY (department_id)
REFERENCES departments(id)
ON DELETE CASCADE
CREATE TABLE departments (
id SERIAL PRIMARY KEY,
name VARCHAR(100)
);
CREATE TABLE employees (
id SERIAL PRIMARY KEY,
name VARCHAR(100),
department_id INT,
CONSTRAINT fk_department FOREIGN KEY (department_id)
REFERENCES departments(id)
ON DELETE CASCADE
);

Added closing parenthesis for employees table SQL statement.


#### Example

In the below example, a build-in `SUM` aggregate function is used and a custom aggregate function `my_sum` is created and used.
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
In the below example, a build-in `SUM` aggregate function is used and a custom aggregate function `my_sum` is created and used.
In the below example, a built-in `SUM` aggregate function is used and a custom aggregate function `my_sum` is created and used.

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.

2 participants