Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

SQL and Database Management Fundamentals, Study notes of Database Programming

This document provides a concise overview of database concepts and SQL. It covers database types (relational and NoSQL), SQL commands for CRUD operations, database structure, table creation, SQL datatypes, and DDL, DML, DCL, DQL, and TCL commands. Key concepts like primary and foreign keys, constraints, and advanced SQL features such as joins, subqueries, and views are explained. It serves as a quick reference for database management and SQL syntax, suitable for students and professionals. Examples include creating databases and tables, inserting and selecting data, using operators and clauses, aggregate functions, GROUP BY and HAVING clauses, cascading for foreign keys, different join types, and UNION and subqueries.

Typology: Study notes

2024/2025

Available from 05/17/2025

kedar-mahamuni
kedar-mahamuni 🇮🇳

1 document

1 / 58

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Database
A software application used to manage our DB is called DBMS (Database Management System)
Database is collection of data in a format that can be easily accessed (Digital)
APNA
COLLEGE
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a

Partial preview of the text

Download SQL and Database Management Fundamentals and more Study notes Database Programming in PDF only on Docsity!

Database

A software application used to manage our DB is called DBMS (Database Management System)

Database is collection of data in a format that can be easily accessed (Digital)

APNA

Types of Databases

Relational Non-relational (NoSQL)

Data stored in tables data not stored in tables

** We use SQL to work with relational DBMS APNA

Database Structure Database Table 1 Data Table 2 Data

APNA

What is a table? Student table

APNA

Creating our First Table

CREATE TABLE table_name (

column_name1 datatype constraint ,

column_name2 datatype constraint,

column_name2 datatype constraint

USE db_name;

APNA

SQL Datatypes They define the type of values that can be stored in a column

APNA

Types of SQL Commands DDL (Data Definition Language) : create, alter, rename, truncate & drop DML (Data Manipulation Language) : select, insert, update & delete DCL (Data Control Language) : grant & revoke permission to users DQL (Data Query Language) : select TCL (Transaction Control Language) : start transaction, commit, rollback etc.

APNA

Database related Queries CREATE DATABASE db_name; DROP DATABASE db_name; SHOW DATABASES ; SHOW TABLES ; CREATE DATABASE IF NOT EXISTS db_name; DROP DATABASE IF EXISTS db_name;

APNA

Table related Queries

SELECT * FROM table_name;

Select & View ALL columns

APNA

Table related Queries Insert

INSERT INTO table_name

(colname1, colname2);

VALUES

(col1_v1, col2_v1),

(col1_v2, col2_v2);

APNA

Keys table1 - Student table2 - City

APNA

Constraints NOT NULL SQL constraints are used to specify rules for data in a table. UNIQUE PRIMARY KEY columns cannot have a null value all values in column are different makes a column unique & not null but used only for one

APNA

Constraints CHECK it can limit the values allowed in a column

APNA

Create this sample table Insert this data

APNA