0% found this document useful (0 votes)
11 views1 page

SQL, Python, Excel: DDL & DML Comparison

The document compares Data Definition Language (DDL) and Data Manipulation Language (DML) operations across SQL, Python (Pandas), and Excel. It provides specific examples for creating, altering, and deleting tables, as well as inserting, updating, and querying data in each platform. The comparison highlights the equivalent commands and methods used in SQL, Python, and Excel for various data operations.

Uploaded by

Utsab Sarkar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

SQL, Python, Excel: DDL & DML Comparison

The document compares Data Definition Language (DDL) and Data Manipulation Language (DML) operations across SQL, Python (Pandas), and Excel. It provides specific examples for creating, altering, and deleting tables, as well as inserting, updating, and querying data in each platform. The comparison highlights the equivalent commands and methods used in SQL, Python, and Excel for various data operations.

Uploaded by

Utsab Sarkar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DDL and DML Comparison: SQL vs Python vs Excel

Category Operation SQL Python (Pandas) Excel Equivalent

DDL Create Table CREATE TABLE employees (id INT, name # Not applicable (use DataFrame) Manual entry or open new sheet
VARCHAR(50));
DDL Alter Table (Add Col) ALTER TABLE employees ADD age INT; df['age'] = None Insert -> Add Column
DDL Alter Table (Rename) ALTER TABLE employees RENAME COLUMN [Link](columns={'name': 'emp_name'}) Right-click -> Rename Column
name TO emp_name;
DDL Drop Table DROP TABLE employees; del df Delete Sheet
DDL Truncate Table TRUNCATE TABLE employees; [Link]([Link], inplace=True) Delete rows
DML Insert Data INSERT INTO employees VALUES (1, 'John'); [Link][len(df)] = [1, 'John'] Enter data manually
DML Update Data UPDATE employees SET name = 'Jane' WHERE id [Link][df['id'] == 1, 'name'] = 'Jane' Use IF() / manually edit cell
= 1;
DML Delete Rows DELETE FROM employees WHERE id = 1; df = df[df['id'] != 1] Delete rows or filter
DML Select Data SELECT * FROM employees; df / [Link]() View spreadsheet
DML Filter Data SELECT * FROM employees WHERE age > 30; df[df['age'] > 30] =FILTER()
DML Join Tables SELECT * FROM A JOIN B ON [Link] = [Link]; df = [Link](B, on='id') VLOOKUP / Power Query Join
DML Sort Data SELECT * FROM employees ORDER BY age df.sort_values('age', ascending=False) Data -> Sort
DESC;
DML Aggregate SELECT AVG(age) FROM employees; df['age'].mean() =AVERAGE()
DML Count Records SELECT COUNT(*) FROM employees; len(df) =COUNTA()
DML Remove Duplicates SELECT DISTINCT name FROM employees; df.drop_duplicates(subset=['name']) Data -> Remove Duplicates

Page 1

You might also like