An open API service indexing awesome lists of open source software.

https://github.com/rahad-ullah/sql-assignment

Assignment - 7 (Level - 2)
https://github.com/rahad-ullah/sql-assignment

postgresql sql

Last synced: about 1 year ago
JSON representation

Assignment - 7 (Level - 2)

Awesome Lists containing this project

README

          

# Answer of 10 Questions

### 1. What is PostgreSQL?

PostgreSQL is an open-source, powerful relational database management system (RDBMS) known for its advanced features and compliance with SQL standards.

### 2. What is the purpose of a database schema in PostgreSQL?

Database schema is a logical grouping of database objects (tables, views, etc.) in PostgreSQL that organizes and separates data, making it easier to manage and secure.

### 3. Explain the primary key and foreign key concepts in PostgreSQL.

**Primary Key:** A unique identifier for a row in a table.
**Foreign Key:** A reference to a primary key in another table, ensuring referential integrity between tables.

### 4. What is the difference between the VARCHAR and CHAR data types?

The difference between the VARCHAR and CHAR data types is: VARCHAR stores variable-length strings, saving space for shorter strings and CHAR stores fixed-length strings, padding shorter ones with spaces.

### 5. Explain the purpose of the WHERE clause in a SELECT statement.

WHERE clause filters rows in a SELECT query based on specified conditions.

### 6. What are the LIMIT and OFFSET clauses used for?

LIMIT restricts the number of rows returned, and OFFSET skips a specified number of rows, useful for pagination.

### 7. How can you perform data modification using UPDATE statements?

UPDATE statement modifies existing data in a table by setting new values for specified columns, optionally filtered with a WHERE clause.

### 8. What is the significance of the JOIN operation, and how does it work in PostgreSQL?

JOIN operation combines rows from multiple tables based on related columns, enabling complex queries across tables in PostgreSQL.

### 9. Explain the GROUP BY clause and its role in aggregation operations.

GROUP BY groups rows with the same values in specified columns, enabling aggregation functions (COUNT, SUM etc.) over each group.

### 10. What is the purpose of an index in PostgreSQL, and how does it optimize query performance?

Index is a data structure that improves query performance by allowing faster data retrieval, often on columns used in filtering or sorting.