CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

MySQL Text Function

 

MySQL Text Function

For preforming the operations on strings, MySQL has provided some function:

1. UCASE ()/UPPER () 

It converts all characters in the specified string to uppercase. If there are characters in the string that are not letters, they are unaffected by this function.

Syntax:
UCASE( string )

Parameter or Arguments:
string: The string to convert to uppercase.

2. LCASE ()/LOWER ()

It converts all characters in the specified string to lowercase. If there are characters in the string that are not letters, they are unaffected by this function.

Syntax:
LCASE( string )

Parameter or Arguments:
string: The string to convert to lowercase.

3. MID ()/SUBSTRING ()/SUBSTR () 

This function allows you to extract a substring from a string.

Syntax:
MID( string, start_position, [length] )
SUBSTR( string, start_position, [ length ] )
SUBSTRING( string, start_position, [ length ] )

Parameter or Arguments:
string: The string from which Substring is required.
start_position: The position to begin extraction. The first position in the string is always 1.
Length: The number of characters to extract

4. LENGTH ()

This function returns the length of the specified string (measured in bytes).

Syntax:
LENGTH( string )

Parameter or Arguments:
string: The string to return the length for.

5. LEFT ()

LEFT function allows you to extract a substring from a string, starting from the left-most character.

Syntax:
LEFT( string, number_of_characters )

Parameter or Arguments:
string: The string that you wish to extract from.
number_of_characters: The number of characters that you wish to extract from a string starting from the left-most character.

6. RIGHT ()

The RIGHT function allows you to extract a substring from a string, starting from the right-most character.

Syntax:
RIGHT( string, number_of_characters )

Parameter or Arguments:
string: The string that you wish to extract from.
number_of_characters: The number of characters that you wish to extract from a string starting from the right-most character.

7. INSTR ()

INSTR function returns the location of a substring in a string.

Syntax:
INSTR( string, substring )

Parameter or Arguments:
string: The string to search.
substring: The substring to search for in string.

8. LTRIM ()

LTRIM function removes all space characters from the left-hand side of a string.

Syntax:
LTRIM( string )

Parameter or Arguments:
string: The string to trim the space characters from the left-hand side.

9. RTRIM ()

RTRIM function removes all space characters from the right-hand side of a string.

Syntax:
RTRIM( string )

Parameter or Arguments:
string: The string to trim the space characters from the right-hand side.

10. TRIM ()

TRIM function removes all specified characters either from the beginning or the end of a string.

Syntax:
TRIM( [ LEADING | TRAILING | BOTH ] [ trim_character FROM ] string )

Parameter or Arguments:
LEADING: Optional. Removes the trim_character from the front of the string.
TRAILING: Optional. Removes the trim_character from the end of the string.
BOTH: Optional. Removes the trim_character from the front and end of string.
trim_character: Optional. The character that will be removed from the string. If this parameter is omitted, it will remove space characters from the string.
string: The string to trim.





MySQL Math Function

 

MySQL Math Function

MySQL provides different Mathematics functions to perform Math operations. In your syllabus we have to learn these three functions:

1. POWER ( ) or POW( ) 

The MySQL POWER function returns m raised to the nth power. (mn)
Ex:- 32 = 9

Syntax:
POWER( m, n ) OR POW( m, n)

Parameters or Arguments:
m: Numeric value. It is the base used in the calculation.
n: Numeric value. It is the exponent used in the calculation.

2. ROUND ( ) 

Returns a number rounded to a certain number of decimal places.
– Ex:- 12.265 rounded to 2 decimal points 12.27 .

Syntax:
ROUND( number, [ decimal_places ] )

Parameters or Arguments:
number: The number to round.
decimal_places: The number of decimal places to round. This value must be a positive or negative integer. If this parameter is omitted, the ROUND function will round the number to 0 decimal places.

3. MOD ( ) 

Returns the remainder of n divided by m.
– Ex:- 5 %  2  =  1 

Syntax:
MOD( n, m )  OR  n MOD m  OR  n % m

Parameters or Arguments:
n: Number.
m: Devisor.



CLASS 12 SAMPLE QUESTION PAPER SOLUTIONS (INFORMATICS PRACTICES) - 2020-21

 

CLASS 12 INFORMATICS PRACTICES SAMPLE QUESTION PAPER

Hello Everyone !!

Hope you are doing great. I have prepared a quetion-wise solution for cbse class 12 computer science sample question paper 2020-21. I have also discussed cbse class 12 computer science question paper pattern 2020. To download the question paper click here.

To check the video you can click on the below-given link. After going to the video you will find time in the description of the video where you can click to go to any question. 

Solution for Sample Question Paper - 2020-21

CLASS 12 SAMPLE QUESTION PAPER SOLUTIONS (COMPUTER SCIENCE) - 2020-21

 

CLASS 12 COMPUTER SCIENCE SAMPLE QUESTION PAPER

Hope you are doing great. I have prepared a question-wise solution for cbse class 12 informatics practices sample question paper 2020-21. I have also discussed cbse class 12 informatics practices question paper pattern 2020. To download the question paper click here.

To check the video you can click on the below-given link. After going to the video you will find time in the description of the video where you can click to go to any question. 

Solution for Sample Question Paper - 2020-21


DBMS Table Keys

DBMS Table Keys

If you are learning about the database, so most welcome to my article. By reading this article today, you will be able to get information about the Keys Of DBMS. So today we are going to discuss What is keys in DBMS and DBMS Keys Types. Here we will learn the basics of Keys. This is a very important topic of CBSE class 11th, related questions are asked in the exam always.

So, Friends, we know about the key in detail.

What Is Key?

Friends, as you know, a key means a key. The way a key is used to open any lock or key is required. In the same way, we need a key to extract any data in the database table. Suppose I made a table and you must have known that a table has both rows and columns. So friends, if you want a particular data from the table, how will you tell what data is needed, then we use the key.  Key We speak those attributes, when you tell the value, we can find a row using the same value. 
  • Keys in DBMS is a set of attributes that help you to identify a row(tuple) in a relation(table).
  • The Key is also helpful for finding a unique record or particular row from the table. 
  • The Key is a Unique Identifier. They allow you to find the relation between two tables.
Example – Aadhar Card, PAN Card, A/c No.

why Do we Need Key?

  • Any colleges/schools or companies have a large level database that contains a lot of tables,  table could contain thousands of records or rows, so Keys help you to identify any row of data in a table. 
  • Keys generate the relation between tables and establish the connection.

How Many Types Are DBMS Keys?

There are the following 6 keys in DBMS-
  1. Candidate Key
  2. Primary Key
  3. Alternate Key
  4. Super Key
  5. Foreign Key
  6. Composite Key 

What Is Candidate Keys? 

  • A set of columns can be called a candidate key if they identify each row of a table uniquely.
  • In a table, there may be more than one column that can have unique values.
  • A table can have multiple candidate keys.
  • A candidate key column cannot have NULL values.

candidate key

What Is Primary Key?

  • The Primary key should be selected from the candidate keys. 
  • Primary keys must contain unique values. 
  • A table cannot have more than one primary key.
  • A primary key column cannot have NULL values.

primary key

What Is Alternate Key?

  • A table can have multiple candidate keys. Among these candidate keys, only one key gets selected as the primary key the remaining keys are known as alternative or secondary keys.
  •  Alternate Keys have all the properties to work as a primary key.

alternate key

What Is Foreign Key?

  • A foreign key is used to create a connection between the tables.
  • A foreign key in one table used to point to the primary key in another table.

foreign key


What Is Composite Key?
  • A composite key is the combination of at least one key attribute and one non-key attribute.
  • In Composite Key, we will identify a particular row using more than one column.

composite key



I think you must have understood this post. you can see this video. Thank You



Class 11 Computer Science Video Lectures

Class 11 Informatics Practices Video Lectures

Data Structures in Python (List / Stack / Queue)

Relational Data Model With Concepts

In this post, we will talk about the Relational data model of class 11th so let's start and know first what is Data? and what is the Database? so Data is our basic information, and a Database is a place where stored the information or data this is called the database.

Above we have learned about the Database, now we will discuss the Types Of Database. Well, the database is many types but in this blog,  we will talk about the Relational Data Model according to the CBSE class 11th IP syllabus.

let us know some important types of Database -
Types of database
  • Hierarchical database
  • Relational database
  • Network database 
  • Graphical database
  • Object-oriented database
  • ER model database

What Is Relational Data Model and Definition of the relational data model

We all know the meaning of Relation. Relation means a Connection. Relational Data Model represents the relationship or connection between the tables. Every row in the table represents the connection between the data. This Model stores the data in the form of tables. Every table consists of Rows and Columns.
All tables are interconnected to each other through a Foreign Key.

Concept of the Relational data model?

You must have understood the Relational data model, now let's talk about the concept. By the way many concepts of relational data models but here we learn about these 6 concepts covering CBSE class 11th syllabus. The relational data model uses the following basic concepts.
  • Relation
  • Tuples / Records / Rows
  • Attribute / Fields / Column
  • Domain
  • Cardinality 
  • Degree

1) What Is Relation?

You will be very well aware of all the Database Tables which contain ROWS and COLUMNS. So here we say in simple words  A relation in a database means a ‘TABLE’. This table has some properties.
  • Every column is unique. It does not contain duplicate data.
  • Every row must be unique, Means will be the same value in one row.
Relation in database

2) What Is Tuple?

Now we talk about the Tuple. It is very easy to understand the tuples Each Row in a Table is called Tuple or Record. One Row means One Tuple or Record.
You can see this example where you are seeing 4 Rows so that means these are the 4 tuples.

tuple in relational data model

3) What Is Attribute?

Now know about Attribute, Each column in a Table is called Attribute or Field. One column means one Attributes
Look at this table here, How many Columns in this table? You will see 4 Columns that mean 4 Attributes or Fields.
attributes in relational data type

3) What Is Domain?

A domain is a unique set of values. Each domain contains a set of data related to a specific purpose.
Here you will see 2 Examples -:

1st Example -: Gender

Whenever you filled any form then you fill this category(Gender), this category values(Male, Female, others) are fixed, you cant change so its set or pool is called a domain.

2st Example -: Days

Similarly, the days and Months is also fixed so its set called domain.


Domain in relational data model

4) What Is Cardinality?

We have already learned about tuple, Now we will know cardinality. The total number of Tuples / Records which in the relation is called the Cardinality.
There is a table here and this table has 4 4Rows, so the total number of rows is called Cardinality.

Cardinality in relational data model

5) What Is Degree?

We have already learned about Attribute, Now we will know the Degree. The total number of attributes in the relation is called the degree.
There is a table here and this table has  4 Columns, so the total number of rows is called Degree.
Degree in relational data model






Customizing Matplotlib plots in Python - adding label, title, and legend in plots

Anatomy of a Pyplot graph

You can customize your pyplot graph by giving different notations as given below in the diagram. Matplotlib's Pyplot interface provides many functions, which you can use to provide legend, X Label, Y Label, X Limit, Y limit, graph Title and many more. 
Pyplot  anatomy

X & Y Labels for the plot

X Label and Y Label represents X-axis and Y-axis Names. You can use plt.xlabel and plt.ylabel for giving the names to X and Y axis respectively. Here plt is an alias for matplotlib.pyplot .
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import matplotlib.pyplot as plt

x = [5,8,10]
y = [12,16,6]
plt.plot(x,y)

plt.title('Epic Info')
plt.ylabel('Y axis')
plt.xlabel('X axis')

plt.show()

The above code will generate the following graph. In the above code, we have given name "X axis" and "Y axis" to X and Y axis respectively.
X & Y Labels for the plot

Title for the plot

The title provides the main heading to the graph. You can give Title using plt.title() function.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import matplotlib.pyplot as plt

x = [5,8,10]
y = [12,16,6]
plt.plot(x,y)

plt.title('Epic Info')
plt.ylabel('Y axis')
plt.xlabel('X axis')

plt.show()

In this above code, I have provided Graph Title "Epic Info" so my Graph is showing Epic Info.  
matplotlib pyplot title

X & Y Limit for the plot

X-Limit and Y-Limit are used to provide the limit of numbers on X-axis and Y-axis. For this purpose xlim() and ylim() functions are used.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import matplotlib.pyplot as plt

x = [5,8,10]
y = [12,16,6]
plt.plot(x,y)

plt.ylim(6, 16)
plt.xlim(5, 10)


plt.show()

The above code is giving X-axis limit from 6 to 16 and Y-axis limit from 5 to 10. You can see the output of the above code below. In this graph X-axis numbers ranging from 5 to 10 and Y-axis numbers are ranging from 6 to 16. 
matplotlib pyplot xlim ylim

X & Y Ticks for the plot

We can give the limits to X-axis and Y-axis using the above xlim and ylim function. But if we want to print only particular numbers on different axis we have to use xticks() and yticks() functions as shown below.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import matplotlib.pyplot as plt

x = [5,8,10]
y = [12,16,6]
plt.plot(x,y)

plt.xticks([5,6,7,8,9,10])
plt.yticks([6,8,10,12,14,16])


plt.show()

In the above code, I am providing the numbers in the form of a list in the functions xticks() and yticks(). So, you can see that in the below-given graph X-axis is showing ticks only for 5,6,7,8,9,10 and Y-axis is showing ticks only for 6,8,10,12,14,16.
matplotlib pyplot xticks yticks

Adding Legend in the plot

Legend specify the use of different colours in our graph. As shown the graphgiven below Blue Color specifies the First Plot and Orange Color specifies the Second Plot.

<matplotlib.pyplot>.legend(loc="upper right")

values for loc:
"upper right" [Default]
"upper left"
"lower right"
"lower left"

Note: For legends you have to give label parameter in plot(), bar() or hist() functions.

matplotlib pyplot python legend


Saving the plot

A plot can be saved in our computer permanently by using savefig() function. This function helps us to save our generated graph permanently in our computer.
 
<matplotlib.pyplot>.savefig(<string with filename and Path>)

Note: 
  • If only the file name is given, save the fig in the current directory.
  • You can save figure in Popular Formats like (.pdf, .png, .eps etc)