Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2K views

Blueprint of Computer Science Class XII

The document provides a blueprint for the Computer Science Class XII exam, outlining the following: 1) Computational Thinking & Python accounts for 40 marks of the exam. 2) Computer Networks accounts for 10 marks. 3) MYSQL and interfacing with Python accounts for 20 marks.

Uploaded by

hellokartik2609
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Blueprint of Computer Science Class XII

The document provides a blueprint for the Computer Science Class XII exam, outlining the following: 1) Computational Thinking & Python accounts for 40 marks of the exam. 2) Computer Networks accounts for 10 marks. 3) MYSQL and interfacing with Python accounts for 20 marks.

Uploaded by

hellokartik2609
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Blueprint of Computer Science Class XII

1. Computational Thinking & Python 40 Marks


2. Computer Networks 10 Marks
3. MYSQL and Interface with Python 20 Marks

Types of Questions
 Identify valid / invalid Identifiers. (identifiers can’t start with digit,
special characters except underscore _ and space not allowed and we can’t
use keywords as an identifier)

 Identify the type of Tokens. (keyword, identifier, operator, literal and


punctuators. i.e. a=10 here a is identifier, = is operator and 10 is literal)
 Error Finding Questions (there will be some error in statement i.e. colon :
missing or elseif instead of elif, comparison operator i.e. = insead of ==,
capital I in if ).
 Output based Questions ( Looping / String / List / Tuple / Dictionary)
 Questions based on operators ( you should know all operators i.e. you
should know ‘in’ is a membership operator and ‘is’ is a identity operator.
Means you have to know which operator belongs to which type of operator.
i.e. and, or, not belongs to logical operators).
 Evaluate the expressions. (Using operators precedence you need to solve
the expression)
 Questions based on inbuilt functions of Python Sequences (i.e. all
functions of list, tuple, string and dictionary)
 FUNCTION OF LIST


 Functions of tuple


 Functions of dictionary


 Questions based on Slicing operation.
(i.e. a[0:5:1] in this 3rd parameter is most important if 3rd parameter is
positive that means you will traverse in forward direction and if 3rd
parameter is negative then we will traverse in reverse direction .
Beta isme sabse pehle question hi likh kar uski indexing kar lena means
upar forward indexing likh lena o se start karke or uske baad reverse
direction me negative indexing kar lena -1 se start karke or uske baad
question me job hi poucha ho uska output aap easily likh sakte ho.
 Create a dictionary with value and key pair. ( we use curly brackets { for
dictionary and two key value pairs separated by comma and key, value
pair separated by colon. i.e. a={‘name’:”Ayushman”,”roll_no”:32,”age”:17}.
 Questions based on concatenation and replication. (a=”harsh” then a*2
will be ‘harshharsh’, b=10, b*2 will be 20. c=”Deepak” d=”pal” then c+d will
be “Deepakpal”, e=10,f=20 then e+f will be 30).
 Small Conceptual based Question on String or list.
 Categorize or identify or difference between mutable or immutable
datatype (i.e. mutable data types : List, Dictionary Set and immutable data
types : int, float, Boolean, complex, string, tuple)
 Random module (various functions in random module are random(),
randint(), uniform(), choice(), suffle(), sample()
 Statistics Module (mean(), mode() , median()
 Math Module ( sin(), cos(), floor(), ceil(), round(), factorial(), asin(), atan(),
copysign(), exp(), fabs(), isqrt(), sqrt(), gcd(), log(), pow(), perm(), trunc()
 Built-in functions ( input(), len(), id(), type(), chr(), ord() )
 Different type of functions ( Default function, positional functional ,
keyword type functions, variable length keyword type functions) definition
and example.
 Formal and Actual Parameters ( difference and definition) actual
parameter and argument both are same
 Local and Global variable ( difference, definition, example and scope)
 Global keyword
 LEGB Rule (Local Enclosed Global and Built-in)
 Small conceptual program, to write function definition part.
 Output based question on function. (you should careful while calling a
function and passing arguments
 Break and continue differences

 Global Variables are the one that are defined and declared outside a
function and we need to use them inside a function.
 Local Variables: A variable declared inside the function's body and in the
local scope is known as a local variable.
 Doc Strings are triple quoted string in Python module program which are
displayed as document when help command is used.
 Modularity: The act of partitioning a program into individual components
(modules) is called modularity.
 Parameters are variables listed within parentheses of a function header.
 Stack data structure (LIFO property, characteristics, functions and
conditions)
o Stack is a linear data structure
o Stack is a list of elements in which an element to be inserted or
deleted only at one end called TOP of the stack.
o Stack follows the principal of LIFO.
Functions in Stack
 PUSH: insertion of an element on the top of the stack . (i.e.
a.append(element) )
 POP: Removal an element from the stack. ( i.e. a. pop() )
 PEEK: To check the element at the top of list. (i.e. a[-1] )
 Display: Display in reverse order (i.e. a[::-1] )
 Isfull()

Conditions in stack:

 Overflow : It refers to a situation, when one tries to push an


element in stack that is already full.
 Underflow: It refers to a situation, when one tries to
pop/delete an item from an empty stack.

Note: In python, stack implemented as list, since list can


grow, overflow condition does not arise.
 Example on Stack.
 Write a function in python, MakePush(Package) and MakePop(Package) to
add a new Package and delete a Package from a list of Package
Description, considering them to act as push and pop operations of the
stack data structure.
def MakePush(Package):
a=input(“Enter the package description : “)
package.append(a)

def MakePop(Package):
if Package==[ ]:
print(“Underflow case “)
else:
print(“Deleted element : “, Package.pop( ))

 Another example of Stack:


 Write a function in Python, Push(Package) and Pop (Package) to add details
of Employee containing information (EmpId, Ename, Salary) in the form of
a tuple in package and delete a package from a list of package description.
Considering them to act as push and pop operation.

def Push(Package):
EmpId = int(input(“Enter the employee id : “))
Ename= input(“Enter the employee name : “)
Salary=int(input(“Enter the salary of an employee: “))
a=[EmpId, Ename, Salary]
Package.append(a)

def MakePop(Package):
if Package==[ ]:
print(“Underflow case “)
else:
print(“Deleted element : “, Package.pop( ))

 Different types of files (Text, Binary and CSV files)


o Text Files: In this type of file, Each line of text is terminated with
a special character called EOL (End of Line), which is the new line
character (‘\n’) in python by default. File extension will be .txt
 Functions for data reading:
 read( )
 readline( )
 readlines( )

Functions for writing data into file:


 write( )
 writelines( )
Beta agar files ka program nahi aata ho to ye program
likh aana chahe kuch bhi poucha ho
Program of vowel, consonant, digit, special character, space, word and line count

vowel_count = 0
consonant_count = 0
digit_count = 0
special_count = 0
space_count=0
word_count = 0
line_count = 0

f=open("abcde.txt","r")
for line in f:
line_count = line_count + 1
words = line.split()
word_count = word_count + len(words)
for i in line:
if i.lower() in "aeiou":
vowel_count = vowel_count + 1

elif i.lower() in "bcdfghjklmnpqrstvwxyz":


consonant_count = consonant_count + 1

elif i in "0123456789":
digit_count = digit_count + 1

elif i.isspace():
space_count = space_count+ 1

else:
special_count = special_count + 1

print("Vowels:", vowel_count)
print("Consonants:", consonant_count)
print("Digits:", digit_count)
print("Special Characters:", special_count)
print("Spaces:", space_count)
print("Words:", word_count)
print("Lines:", line_count)
 Binary files : binary files are made up of non-human readable
characters and symbols, which require specific programs to access its
contents. File extention will be .dat
o pickle module is used while working with Binary files.
o Functions in Binary files:
 load( ) it is used to read data from binary file.
 Syntax: identifier = pickle.load(file_pointer)
 Example: data = pickle.load(f) #here data is identifier
and f is a file pointer.

dump( ) it is used to write data into binary file.


Syntax: identifier = pickle.dump(data , file_pointer)
Example: a= “My name is Manish Dahiya”
pickle.dump(a,f) #here a contains data and
and f is a file pointer.

 CSV files : csv module implements classes to read and write tabular data
in CSV format. It allows programmers to say, “write this data in the
format preferred by Excel. File extension will be .csv
o csv module is used while working with csv files.
o Functions in CSV files:
 Reader ( ) : to read data from csv files.
 Syntax: identifier = csv.reader( )
 Example: data = csv.reader( )

Writer ( ) : to write data into csv files. In this we write


data in the form of rows and columns.
 Example : a=[“Name”,”Age”,”Class”]
fo= csv.writer(f)
fo.writerow(a)
In csv files for writing data into files we have two functions under
writer are writerow( ) and writerows( ).

Access Specifiers in files :


 r (if file don’t exist it will give error)
 r+
 w (if file don’t exist it will create new file)
 w+
 a
 a+
 rb (read data from binary files)
 wb (write data into binary files)
 ab ( append data into binary files)
 rb+
 wb+
 ab+

seek( ) and tell( ) functions:


seek ( ) : In Python, seek() function is used to change the position of the File
Handle to a given specific position. File handle is like a cursor, which defines
from where the data has to be read or written in the file.
Syntax: f.seek(offset, from_what), where f is file pointer
Parameters:
Offset: Number of positions to move forward
from_what: It defines point of reference.
Returns: Return the new absolute position.

0: sets the reference point at the beginning of the file


1: sets the reference point at the current file position
2: sets the reference point at the end of the file
By default from_what argument is set to 0.
tell( ): tell() method can be used to get the position of File Handle. tell()
method returns current position of file object. This method takes no parameters
and returns an integer value. Initially file pointer points to the beginning of the
file(if not opened in append mode). So, the initial value of tell() is zero.
Syntax: file_object.tell()

Absolute and Relative Path:


An absolute file path describes how to access a given file or directory, starting
from the root of the file system. A file path is also called a pathname. Relative
file paths are notated by a lack of a leading forward slash. A relative file path is
interpreted from the perspective your current working directory.

In this current working directory is c:\bacon


Errors
 An error or a bug is anything in the code that prevents a program
from compiling and running correctly.
 There are three types of errors:
 Compile Time errors occur at compile time.
 These are of two types :
o Syntax errors occur when rules of programming language are
misused.
o Semantics errors occur when statements are not meaningful.
 Run Time errors occur during the execution of a program.
 Logical Errors occur due to programmer’s mistaken analysis of the
error.
 To remove logical errors is called debugging.
 Debugging: Debugging is the process of detecting and removing of
existing and potential errors in a software code that can cause it to
behave unexpectedly or crash.
 Debugger: Debugger is a computer program used by programmers to
test and debug a target program.
 Standard Input / Output and Error Streams
 Python's sys module provides us with file-like objects that represent
stdin, stdout, and stderr.
 stdin , stdout , and stdderr variables contain stream objects
corresponding to standard I/O streams.
 • Standard input: This is the file-handle that a user program reads to
get information from the user. We give input to the standard input
(stdin).
 • Standard output: The user program writes normal information to
this file-handle. The output is returned via the Standard output
(stdout).
 • Standard error: The user program writes error information to this
file-handle. Errors are returned via the Standard error (stderr).
 After importing sys Module we can use these Standard Streams in
the same way you use other files.
 Serialization: Serialization is the process of transforming data or an
object in memory (RAM) to a stream of bytes called byte streams.
These byte streams in a binary file can then be stored in a disk or in
a database or sent through a network.
 De-serialization: De-serialization or unpickling is the inverse of
pickling process where a byte stream is converted back to Python
object.
 Pickle module contains a dump() function to perform pickling and
pickle module contains load() function to perform unpickling.
COMPUTER NETWORK
 Abbrevations
o ARPANET : Advanced Research Projects Agency Network.
o NSFNET: National Science Foundation Network.
o CDMA: Code Division Multiple Access
o GSM: Global System for Mobile communication.
o HTML: Hyper Text Mark-up Language.
o HTTP: Hyper Text Transfer Protocol
o IP: Internet Protocol
o TCP/IP: Transmission Control Protocol / Internet Protocol
o ISP : Internet Service Provider
o LAN: Local Area Network.
o MAN : Metropolitan Area Network.
o WAN: Wide Area Network.
o PAN : Personal Area Network
o CAN: Campus Area Network
o USB: Universal Serial Bus
o bps: Bits per Second.
o Bps: Bytes per Second.
o Mbps: Megabits per second
o Gbps: Gigabits per second
o MODEM: Modulator Demodulator
o IMEI: International Mobile equipment Identity.
o www: World Wide Web.
o HTML: HyperText Markup Language
o XML: Extensible Markup Language
o HTTPs: HyperText Transfer Protocol secure
o GPRS: General Packet Radio Service
o SMS: Short Message Service
o TELNET: Teletype Network
o FDM: Frequency Division Multiplexing
o TDM: time Division Multiplexing
o VoLTE: Voice over Long-Term Evolution.
o AM: Amplitude Modulation.
o MAC: Media Access Control
o NIC: Network Interface Card
o P2P: Peer to Peer Network.
o SMTP: Simple Mail Transfer Protocol
o VoIP: Voice over Internet Protocol
o VPN: Virtual Private Network.
o UTP: Unshielded Twisted Pair
o STP: Shielded Twisted Pair
o RJ: Registered Jack
o Wi-Fi: Wireless Fidelity
o IAAS: Infrastructure As A Service
o PAAS: Platform As A Service
o SAAS: Software As A Service
o DAAS: Desktop As A Service
o CSMA/CD: Carrier Sense Multiple Access/ Collision Detection
o CSMA/CA : Carrier Sense Multiple Access/ Collision Avoidance
o DNS: Domain Name System
o URL: Uniform Resource Locator
o FTP: File Transfer Protocol
o SIM: Subscriber Identity Module
o GPRS: General Packet Radio Service
o POP: Post Office Protocol

 Topologies:
 Topology refers to the way in which the workstations attached to the network
are interconnected.
 Some common network topologies are as follows:
 Bus Topology: It uses a common single cable to connect all the workstations.
Each computer performs its task of sending messages without the help of the
central server. However, only one workstation can transmit a message at a
particular time in the bus topology.
 Advantages:
 • Easy to connect and install.
 • Involves a low cost and installation time.
 • Can be easily extended.
 Disadvantages:
 • The entire network shuts down if there is a failure in the central cable.
 • Only a single message can travel at a particular time.
 • Difficult to troubleshoot an error.
 Star Topology: It is based on a central node which acts as a hub. A star
topology is common in-home networks where all the computers connect to the
single central computer, using a hub.
 Advantages:
 • Easy to troubleshoot.
 • A single node failure does not affect the entire network.
 • Fault detection and removal of faulty parts is easier.
 • In case a workstation fails, the network is not affected.
 Disadvantages:
 • Difficult to expand.
 • Longer cable is required.
 • The cost of the hub and the longer cables make it expensive over others.
 • In case hub fails, the entire network fails.
 Tree Topology: It combines the characteristics of the linear bus and star
topologies. It consists of groups of star configured workstation connected to a
bus backbone cable.
 Advantages:
 • Eliminates network congestion.
 • The network can be easily extended.
 • Faulty nodes can be easily isolated from the rest of the network.
 Disadvantages:
 • Uses large cable length.
 • Requires a large amount of hardware components and hence is expensive.
 • Installation and reconfiguration is very difficult.

 Definition of various terms


 Case Study based Question (building blocks)
 Wired and Wireless Media

 Transmission Media
 Transmission media of a network refers to the connecting media used in the
network. It can be broadly defined as anything that can carry information from
a source to destination.
 (A) Twisted Pair Cable : It consists of two identical 1mm thick copper wires
insulated and twisted together. The twisted pair cables are twisted in order to
reduce crosstalk and electromagnetic induction.
 Advantages:
 • It is easy to install and maintain.
 • It is inexpensive.
 Disadvantages:
 • It is incapable to carry a signal over long distance without the use of
repeaters.
 • Due to low bandwidth, these are unsuitable for broadband applications.
 (B) Coaxial Cable : It consists of a solid wire core surrounded by one or more
coil or braided wire shields, each separated from the other by some kind of
plastic insulator. It is mostly used in the cable wires.
 Advantages:
 • Data transmission rate is better than twisted pair cables.
 • It provides a cheap means of transporting multi-channel television signals
around metropolitan areas.
 Disadvantages:
 • Expensive than twisted pair cables.
 • Difficult to manage and reconfigure.
 (C) Optical fiber : It consists of thin glass fibres that can carry information in
the form of visible light.
 Advantages:
 • Transmit data over long distance with high security.
 • Data transmission speed is high.
 • Provide better noise immunity.
 • Bandwidth is up to 10 Gbps.

 Disadvantages:
 • Expensive as compared to other guided media.
 • Need special care while installation.
 (D) Infrared: The infrared light transmits data through the air and can
propagate within a room, but will not penetrate walls. It is a secure medium of
signal transmission. The infrared transmission has become common in TV
remote, automotive lift doors, wireless speakers, etc.
 Advantages:
 • Power consumption is used.
 • Circuitry cost is less.
 • Secure mode of transmission.
 Disadvantages
 • Limited to a short range.
 • Can be blocked by common materials like walls, people, plants, etc.
 (E) Radio wave : It is an electromagnetic wave with a wavelength between 0.5
cm to 30,000m. The transmission making use of radio frequencies is termed as
radio-wave transmission.
 Advantages:
 • Radio wave transmission offers mobility.
 • It is cheaper than laying cables and fibers.
 • It offers ease of communication over difficult terrain.
 Disadvantages:
 • Radio wave communication is insecure communication.
 • Radio wave propagation is susceptible to weather effects like rains, thunder
storms etc.
 (F) Microwave : The microwave transmission is a line of sight transmission.
Microwave signals travel at a higher frequency than radio waves and are
popularly used for transmitting data over long distances.
 Advantages:
 • It is cheaper than laying cable or fiber.
 • It has the ability to communicate over oceans.
 Disadvantages:
 • Microwave communication is an insecure communication.
 • Signals from antenna may split up and get transmitted in different way to
different antenna which leads to reduce in signal strength.
 • Microwave propagation is susceptible to weather effects like rains, thunder
storms, etc.
 • Bandwidth allocation is extremely limited in case of microwaves.

 Various Protocols

 A protocol means the rules that are applicable for a network. It defines the
standardized format for data packets, techniques for detecting and correcting
errors and so on. A protocol is a formal description of message formats and the
rules that two or more machines must follow to exchange those messages.
 Types of protocols are:
 Hypertext Transfer Protocol (HTTP): It is a communication protocol for the
transfer of information on the Internet and world wide web. HTTP is a
request/response standard between a client and a server. A client is the end-
user while, the server is the website.
 FTP (File Transfer Protocol): It is the simplest and most secure way to exchange
files over the Internet. The objectives of FTP are:
o To promote sharing of Files (computer programs and/or data).
o To encourage indirect or implicit use of remote computers.
o To shield a user from variations in file storage systems among different
hosts.
o To transfer data reliably and efficiently.
TCP/IP (Transmission Control Protocol/ Internet Protocol): TCP is responsible for
verifying the correct delivery of data from client to server. Data can’t be lost in the
intermediate network. TCP adds support to detect errors or lost data and to trigger
retransmission until the data is correctly and completely received.
IP is responsible for moving packet of data from node to node. IP forwards each packet
based on a four-byte destination address (the IP number). The Internet authorities
assign ranges of numbers to different organisations. The organisations assign groups
of their numbers to departments. IP operates on gateway machines that moves data
from department to organization, then to region and then around the world.
 SMTP(Simple Mail Transfer Protocol): It is a standard protocol for email services
on TCP/IP network that provides ability to send and receive e-mail.
 POP3 (Post Office Protocol Version3): It is a message access protocol which
allows client to fetch an e-mail from remote mail server.
 Telnet is a network protocol used to virtually access a computer and to provide
a two-way, collaborative and text based communication channel between two
machines.
 PPP (Point - to - Point Protocol): It is a communication protocol of the data link
layer that is used to transmit multiprotocol data between two directly connected
(point-to-point) computers. It is a byte - oriented protocol that is widely used in
broadband communications having heavy loads and high speeds.
 HTTPS (Hypertext transfer protocol secure): It is the secure version of HTTP,
which is the primary protocol used to send data between a web browser and a
website. HTTPS is encrypted in order to increase security of data transfer.
 • VoIP (Voice over Internet Protocol): It is a proven technology that lets anyone
place phone calls over an internet connection. With the rise of broadband, VoIP
has become the definitive choice of phone service for consumers and businesses
alike.
 Network Devices
 These are units that mediate data in a computer network and are also called
network equipment. Some of them are following:
 • Modem: A MODEM (Modulator Demodulator) is an electronic device that
enables a computer to transmit data over telephone lines. There are two types
of modems namely, internal modem and external modem.
 • RJ45 Connector: The RJ-45 (Registered Jack) connectors are the plug-in
devices used in the networking and telecommunication applications. They are
used primarily for connecting LANs, particularly Ethernet.
 • Ethernet card: It is a hardware device that helps in connection of nodes within
a network.
 • Hub: It is a hardware device used to connect several computers together.
Hubs can be either active or passive. Hubs usually can support 8,12 or 24
RJ45 ports.
 • Switch: A switch (switching hub) is a network device which is used to
interconnect computers or devices in a network. It filters and forwards data
packets across a network. The main difference between a hub and a switch is
that hub replicates what is received on one port onto all the other ports while
switch keeps a record of the MAC addresses of the devices attached to it.
 • Router: It is a hardware device which is designed to take incoming packets,
analyse packets, moving and converting packets to the another network
interface, dropping the packets, directing packets to the appropriate locations,
etc.
 • Gateway: It is a device that connects dissimilar networks.
 • Repeater: It is a network device that amplifies and restores signals for long
distance transmission.
 • Wi-Fi card: Connects to your laptop either in your USB port or wider card slot.
This card generally is geared to a particular Wi-Fi network, so to use it you
must be in range of a wireless internet signal dedicated to that network.
 Difference between HTML and XML


 • WWW: The world wide web or W3 or simply the web is a collection of linked
documents or pages, stored on millions of computers and distributed across the
Internet.
 HTML (HyperText Markup Language): It is a computer language that describes
the structure and behavior of a web page. This language is used to create web
pages.
 • XML (Extensible Markup Language): It is a meta language that helps to
describe the markup language.
 • Domain Name: It is a unique name that identifies a particular website and
represents the name of the server where the web pages reside.
 • URL(Uniform Resource Locator): It is a means to locate resources such as web
pages on the Internet. URL is also a method to address the web pages on the
Internet. There are two types of URL namely, Absolute URL and Relative URL.
 • Website: A collection of related web pages stored on a web server is known as
a website.
 • Web browser: A software application that enables to browse, search and
collect information from the web is known as web browser.
 • Web server: The web pages on the Internet are stored on the computers that
are connected to the Internet. These computers are known as web servers.
 • Web hosting: Web hosting or website hosting is the service to host, store and
maintain websites on the world wide web.
 Website, Webpage, Webserver, static and dynamic website, webpage, Domain
name, URL, IP Address
 Switching Techniques


DATABASE MANAGEMENT
DBMS Terminologies

 DBMS: It stands for Database Management System that enables users to


define, create and maintain the database and provides controlled access to this
database.
 DBA: DBA is Database Administrator that has the central control over the
system.
 RDBMS: RDBMS stands for Relational Database Management System.
 Meta Data: It means data about data i.e., a logical description of the structure
of a data.
 File Processing System: It is a collection of new data files stored in the hard
drive of a system.

SQL FEATURES:
 SQL is easy to learn.
 SQL is used to access data from relational database management systems.
 SQL can execute queries against the database.
 SQL is used to describe the data.
 SQL is used to define the data in the database and manipulate it when
needed.
 SQL is used to create and drop the database and table.
 SQL is used to create a view, stored procedure, function in a database.
 SQL allows users to set permissions on tables, procedures, and views .

Definition with example of various types of keys.

 Super Key – A super key is a group of single or multiple keys which identifies
rows in a table.
 Primary Key – is a column or group of columns in a table that uniquely identify
every row in that table.
 Candidate Key – is a set of attributes that uniquely identify tuples in a table.
Candidate Key is a super key with no repeated attributes.
 Alternate Key – is a column or group of columns in a table that uniquely
identify every row in that table.
 Foreign Key – is a column that creates a relationship between two tables. The
purpose of Foreign keys is to maintain data integrity and allow navigation
between two different instances of an entity.
 Compound Key – has two or more attributes that allow you to uniquely
recognize a specific record. It is possible that each column may not be unique
by itself within the database.

Identify the Degree and Cardinality of a relation

 Cardinality refers to the number of tuples/rows in a table whereas, Degree


refers to the number of attributes/columns in a table.

Full form of DDL and DML

 Data Definition Language (DDL) Commands: All the commands used to create,
modify or delete physical structure of an object like table. e.g., Create, Alter,
Drop.
 Data Manipulation Language (DML) Commands: All the commands used to
modify contents of a table comes under this category. e.g., Insert, Delete,
Update
 Transaction Control Language (TCL) Commands: These commands are
used to control transaction of DML commands. e.g., Commit, Rollback.

Categorize and commands into DDL and DML

Count( ) and count( * )

Definition with example of Domain, Relation, Tuple, Attribute or Cardinality.

Aggregate functions

Constraints in MYSQL
Correct syntax of given SQL command.

 SELECT
 NULL
 LIKE
 ORDER BY
 Condition using WHERE CLAUSE
 BETWEEN
 GROUP BY, HAVING
 JOIN
 COUNT
 DISTINCT
 UPDATE

Questions to write Queries and output of Queries

INTERFACE OF PYTHON WITHY SQL


Definition of fetchone( ), fetchmany( ) and fetchall( ) with example.

fetchone( ) : It will return one record from the resultset as a tuple, First time, it will
fetch the first record, next time it will fetch the second record and so on.

fetchmany( n ): This method fetches n records in the form of a tuple (i.e. returns the
list of tuples.)

fetchmany( ): It returns all the records retrieved as per query in a tuple form. It will
return the list of tuples. It retrieve all the records and display them.

Rowcount property, commit( )

Rowcount: It is a variable which returns the number of rows retrieved from the last
command.

Commit( ). It lets a user permanently save all the changes made in the transaction of a
database or table.

Syntax to create connection with Database.

Structure of connectivity programs.

The following steps to follow while connecting your python program with MySQL
1. Import the package required (import mysql.connector)
2. Open the connection to database
3. Create a cursor instance
4. Execute the query and store it in resultset
5. Extract data from resultset
6. Clean up the environment

A small code to perform insert, update and delete queries.

Beta agar kuch bhi samaj na aaye to ye


program likh aana.
import mysql.connector

# establish a connection to the database


mydb = mysql.connector.connect(
host="localhost",
user="root",
password="12345678",
database="school"
)
# create a cursor object to execute SQL queries
mycursor = mydb.cursor()

# insert data into the table


sql = "INSERT INTO student (name, class) VALUES (%s, %s)"
val = ("Chirag", "12th")
mycursor.execute(sql, val)
mydb.commit()
print(mycursor.rowcount, "record inserted.")

# update data in the table


sql = "UPDATE student SET name = %s WHERE class = %s"
val = ("chirag", "Garv")
mycursor.execute(sql, val)
mydb.commit()
print(mycursor.rowcount, "record(s) affected.")

# delete data from the table


sql = "DELETE FROM school WHERE name = %s"
adr = ("Garv", )
mycursor.execute(sql, adr)
mydb.commit()
print(mycursor.rowcount, "record(s) deleted.")

You might also like