CSCI101 Database Tutorial 6 PDF
Document Details
Uploaded by Deleted User
Nile University
Tags
Summary
This document is a tutorial on structured databases for a CSCI101 course at Nile University. It covers various database concepts like types of data, pros and cons of structured vs unstructured databases, and database management systems(DBMS).
Full Transcript
CSCI101 Structured Database TUTORIAL 6 – WEEK 7 Nile University CSCI101 Team CSCI101 Data What is Data? is a collection of discrete or continu...
CSCI101 Structured Database TUTORIAL 6 – WEEK 7 Nile University CSCI101 Team CSCI101 Data What is Data? is a collection of discrete or continuous values that convey information, describing the quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted formally. Examples? ⚬ A list of students with their grades (CS) ⚬ Inventory list in a store (Business) ⚬ Patient records in a hospital (Biomedical) ⚬ List of materials for a project (Engineering) Tutorial Task TASK 1 On a Paper: List 2-3 examples of data you encounter in your daily life and explain why it's important to manage it. Nile University CSCI101 Team CSCI101 Types of Data Structured Unstructured Organized data in a defined format, Data that doesn’t follow a specific format, like tables. like text documents or images. CSCI101 Structured DB: Pros and Cons Structured DB pros cons Organized data Rigid structure Easy to search (SQL) Hard to adapt Strong data Struggles with big data relationships Slow with complex queries Data accuracy Great for transactions CSCI101 Unstructured DB: Pros and Cons Unstructured DB pros cons Flexible data storage Harder to search Scales well Weaker relationships Fast for big data Lower data accuracy Easy to change data Less reliable for transactions types CSCI101 Database What is a Database? A database is an organized collection of structured data, typically stored and accessed electronically. Examples ⚬ A library catalog system, where books are categorized by title, author, and subject. CSCI101 Database Why is it so IMPORTANT? CSCI101 Structured Database Components of a Structured Entity Table Organizes data into rows and columns. Field A column in a table, representing a specific attribute of the items. Record A single row in a table, representing a single item. CSCI101 Relational Database What is Relational Databases? A type of structured database where data is stored in related tables. Key Terms: ⚬ Primary Key: "A unique identifier for each record.“ ⚬ Foreign Key: "A field that links one table to another." CSCI101 Entity Relationship Diagrams (ERDs) Data Types Numbers: int Float: number with decimals Ex. (3.14, 1.00) characters: char strings: char(SIZE) A string is a word, sentence, etc CSCI101 ERD Entity Relationship Diagram CSCI101 Entities An Entity has a: CSCI101 Entities An Entity has a: CSCI101 Entities An Entity has a: CSCI101 Entities An Entity has a: CSCI101 Relational Database Relations: Primary key of Orders is used in Shipments as a foreign key in a One to many relationship CSCI101 Relational Database Relationships in Databases: Tutorial Task TASK 2 On a Paper: Draw a simple ERD showing two related tables: Students and Enrollments. Identify the primary and foreign keys. Nile University CSCI101 Team CSCI101 Database Management System (DBMS) What is Database Management System (DBMS)? Software that allows you to create, manage, and interact with databases. Examples ⚬ MySQL ⚬ Oracle ⚬ SQL Server CSCI101 Database Let’s see it in Action CSCI101 Open Discussion After seeing all of this; why not just use Excel?? CSCI101 Structured Query Language (SQL) SQL Structured Query Language is a domain-specific language used to manage data, especially in a relational database management system. Used to perform tasks such as: ⚬ Creating tables ⚬ Inserting data ⚬ Updating records ⚬ Deleting records ⚬ Retrieving data CSCI101 Creating a DB in SQL Creating a DB CREATE DATABASE school_db; USE school_db; CSCI101 Creating a DB in SQL Creating a Table CREATE TABLE students ( student_id INT PRIMARY KEY, name CHAR(100), major CHAR(100), gpa FLOAT, age INT ); CSCI101 Creating a DB in SQL Creating a Table CREATE TABLE students ( student_id INT PRIMARY KEY, name CHAR(100), major CHAR(100), gpa FLOAT, age INT ); CSCI101 Creating a DB in SQL Creating a Table CREATE TABLE students ( student_id INT PRIMARY KEY, name CHAR(100), major CHAR(100), gpa FLOAT, age INT ); CSCI101 Creating a DB in SQL Creating a Table CREATE TABLE students ( student_id INT PRIMARY KEY, name CHAR(100), major CHAR(100), gpa FLOAT, age INT ); CSCI101 Database How is it used in the REAL-WORLD? CSCI101 THANK YOU Any Questions? NILE University End Slide