0% found this document useful (0 votes)
0 views10 pages

04 CS 10 Page Python SQL

The document provides a comprehensive overview of Class 12 Computer Science topics including Python basics, SQL queries, database design, networking, and cyber safety. Key concepts covered include data types, functions, file handling in Python, SQL aggregate functions, and the importance of network devices. It emphasizes best practices for digital security and the functionality of various internet services.
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)
0 views10 pages

04 CS 10 Page Python SQL

The document provides a comprehensive overview of Class 12 Computer Science topics including Python basics, SQL queries, database design, networking, and cyber safety. Key concepts covered include data types, functions, file handling in Python, SQL aggregate functions, and the importance of network devices. It emphasizes best practices for digital security and the functionality of various internet services.
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

Class 12 Computer Science – Python, SQL &

Networking
Original Class 12 CBSE Study Material • A4 Printable Edition

Python Basics
Python uses indentation to define blocks. Variables do not require explicit type declarations. Common
data types include int, float, str, list, tuple, dictionary and set. Operators include arithmetic, relational,
logical and assignment operators.

Page 1
Functions
A function is a reusable block of code. It may accept parameters and return a value. Defining functions
reduces repetition and improves readability. Local variables are generally available only within the
function in which they are created.

Page 2
Strings and Lists
Strings are sequences of characters and support indexing and slicing. Lists are ordered and mutable.
Common list methods include append(), extend(), insert(), remove(), pop() and sort(). The len() function
gives the number of elements.

Page 3
Dictionaries and Tuples
A dictionary stores data as key-value pairs. Keys should be unique within a dictionary. Methods such as
keys(), values() and items() are frequently used. Tuples are ordered collections that cannot normally be
modified after creation.

Page 4
File Handling
Files can be opened using open(). Common modes are r for reading, w for writing and a for appending.
read() obtains content, readline() reads a line, and readlines() returns a list of lines. Using with open(...)
automatically handles closing the file.

Page 5
SQL Queries
SELECT is used to retrieve data. WHERE filters individual rows. ORDER BY sorts the output. DISTINCT
removes duplicate results. SQL statements should be written carefully with correct table and column
names.

Page 6
Aggregate Functions
COUNT, SUM, AVG, MIN and MAX are common SQL aggregate functions. GROUP BY creates groups
based on one or more columns. HAVING filters groups after grouping, while WHERE filters rows before
grouping.

Page 7
Database Design
A database organises related data. A primary key uniquely identifies a record. A foreign key refers to a
key in another table and helps establish relationships. Normalisation can reduce redundancy and
improve consistency.

Page 8
Networking
A computer network allows devices to communicate and share resources. LAN is used over a limited
area, while WAN covers large geographical areas. A switch connects devices in a local network, and a
router forwards packets between networks.

Page 9
Cyber Safety and Internet Services
Strong passwords, software updates and careful handling of links help protect digital accounts. Common
internet services include web browsing, email and file transfer. HTTP and HTTPS are used for web
communication, while DNS translates domain names into IP addresses.

Page 10

You might also like