Posts

Showing posts with the label Database Design

Design a database schema for an online merch store

Image
Designing a database schema for an online merchandise store involves considering various entities and their relationships. 1. Entities: A. Users: - UserID (Primary Key) - Username - Password - Email - Address - Phone number B. Products: - ProductID (Primary Key) - Name - Description - Price - CategoryID (Foreign Key) C. Categories: - CategoryID (Primary Key) - Name D. Orders: - OrderID (Primary Key) - UserID (Foreign Key) - OrderDate - TotalPrice E. OrderItems: - OrderItemID (Primary Key) - OrderID (Foreign Key) - ProductID (Foreign Key) - Quantity - Price 2. Relationships : - Each user can have multiple orders, but each order belongs to only one user. (One-to-Many relationship between Users and Orders) - Each order can contain multiple items, and each item can belong to multiple orders. (Many-to-Many relationship between Orders

Database Management System Que & Ans

Image
Que - Explain functional dependency and its types with examples in detail. Ans -   Functional dependency is a crucial concept in the field of relational databases. It describes the relationship between attributes (or columns) in a relation (or table). In simpler terms, it tells us how one attribute's value determines another attribute's value within a table. Let's dive deeper into the definition and types of functional dependencies with examples: Definition: A functional dependency � → � X → Y in a relation holds if and only if, for every valid instance of � X , there is exactly one corresponding instance of � Y . This means that if two tuples (rows) in a relation agree on a set of values for � X , they must also agree on the corresponding values for � Y . Types of Functional Dependencies: Full Functional Dependency: A full functional dependency occurs when removing any attribute from the determinant � X results in a loss of the functional dependency. In other words,