CBSE CS and IP

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

Showing posts with label Class 11 IP. Show all posts
Showing posts with label Class 11 IP. Show all posts

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



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






String Data Type in Python

Strings in Python
String Definition / What Is Strings in Python?

Python string is characters/numbers/special characters enclosed in quotes of any type - single quotation marks (' '), Double quotation marks ( " ") and triple quotation marks (" " "). An empty string is a string that has 0 characters (i.e. it is just a pair of quotation marks) Python string is immutable. you have used string in earlier chapters to store text type of data.

Every character of the string is given a special number that is called its index position. Consider the following string:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
my_string = "Hello World"
print(my_string)
print(type(my_string))

'''
Output:
Hello World
<class 'str'>
'''

#Index Positions
# H   e  l  l  o  W  o  r  l  d
# 0   1  2  3  4  5  6  7  8  9 (Forward)
#-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 (Backward)                         

By the above example, you can see that my_string is a variable of string type and all the characters of the string will have one unique index.

By now you must know that strings are a sequence of characters. where each character has a unique position - id/index. The index of a string begins from 0 and end on (length - 1) in the forward direction and -1,-2,-3....,-length in the backward direction. As in the example in the forward direction index are 0,1,2....,9 and in backward direction -1,-2,-3.....-10.

Accessing Individual elements of Python String

Since every elements has its Unique Index in Python we can access any element from string by just providing the Index in square brackets with string Name. See the following Example:
1
2
3
4
5
6
7
8
9
>>> my_string = "Hello World"                                      
>>> my_string[0]
'H'
>>> my_string[1]
'e'
>>> my_string[-1]
'd'
>>> my_string[-2]
'l'

Traversing A String -:

Traversing refers to iterating through the elements of a string, one character at a time. You know that individual characters of a string are accessible through the unique index of each character. Using the indexes you can traverse string character by character. We can traverse a string by using the for loop. You can write a loop like :
Example -:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
for i in "Hello World":                                            
     print(i)

'''
Output:
H
e
l
l
o

W
o
r
l
d
'''

String  Operators -:

You will be learning to work with various operators that can be used to manipulate strings in multiple ways. We will be talking about basic operators + and * membership operators in and not in and comparison operators (all relational operators) for strings.
  1.  Basic Operators
  2.  Membership Operators
  3.  Comparison Operators

(1) Basic Operators -: 

The two basic operators of the string are + and *. You have used these operators as arithmetic operators before for addition and multiplication respectively. But "+ operator" is used with string operands it performs "concatenation" rather than addition and "* operator" performs "replication" rather than multiplication.

Also before we proceed,  recall that strings and immutable i.e. and un-modifiable. Thus every time you perform something on a string that changes it Python will internally create a new string rather than modifying the old string in place.

a) Working Of Python * operators -:

The * operator, when used with numbers, (i.e.  When both your operands are numbers),  it performs multiplication and returns the product of the two number operands.

To use a * operator with string, you need to type of operands-:
(1) string
(2) number
It can be in the following forms:
number * string or string * number

Where string operands tell the String to be replicated and number operand tells the number of times, it is to be repeated. Python creates a new string that is a number of repeated addition of the string operator.
Example -:
1
2
3
4
5
6
>>> my_string = "Hello World"
>>> my_string * 3
'Hello WorldHello WorldHello World'
>>>
>>> 3 * my_string
'Hello WorldHello WorldHello World'                                

b) Working Of Python + Operators -:

This + operator has to either have both operands of the number types (for multiplication) or both should be of string type. It can not work with one operand string types and another as number type.
Example-:
1
2
3
4
5
6
>>> "Hello" + "World"
'HelloWorld'
>>> "Hello" + 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can only concatenate str (not "int") to str             
In the above example, you can see we can not add One String and One number.

(2) Membership Operators -:

There are two membership operators for string (in fact for all sequence types). These are in and not in. Let us learn about these operators in the context of strings.

in         -: Returns TRUE if a character or a substring exists in the given string; FALSE otherwise
not in  -: Returns TRUE if a character or a substring does not exist in the given string; FALSE otherwise

both membership operators (when used with string), require that both operands used with them are of string type i.e.
Example-:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
>>> 'H' in 'Hello World'
True
>>> 'Y' in 'Hello World'
False


>>> 'H' not in 'Hello World'
False
>>> 'Y' not in 'Hello World'                                       
True

(3) Comparison Operators -:

Python standard comparison operators i.e. All relational operators (<,<=,>,>=, ==, !=)  apply to strings also. The comparisons using these operators are based on the Standard character by character comparison rules for Unicode (i.e. Dictionary order).

Equality and Non-Equality in strings are easier to determine because it goes for exact character matching for individual letters including the case (uppercase or lowercase) of the letter. 

But for another comparison like less than (<)  or greater than(>)  you should know the following piece of useful information. 
  • Python checks the Ordinal values while comparing String using (<, >, <=, >=).
  • You can find the ordinal value of any char by using ord(<char>) function. Find the characters and their ordinal values(ASCII values):
    Characters Ordinal Values
    ‘0’ to ‘9’ 48 to 57
    'A’ to ‘Z’ 65 to 90
    ‘a’ to ‘z’ 97 to 122
  • Ordinal values are compared character by character.
Example-:
1
2
3
4
5
6
7
'a'  <  'A'             False
'A'  >  'a'		True
'ABC' > 'AB'	        True
'abc' <=  'ABCD'	False                                      
'abc' < 'Acd'	        False
'abc' > 'Acd'	        True
'abcd'> 'A'	        True	

Cyber Safety And Security (CBSE Class 11)

cyber safety and security class 11 cbse
What is cyber safety/Internet Safety?

Today's age cannot be thought without the Internet, even in dreams. Nowadays every person is being a victim of online fraud. Mostly children are caught in this trap so the first thing we need to know is how to protect a child from online fraud? The government has started its cyber safety and security lesson for the 11th class. So that children can avoid online fraud. For this, the parents have to be aware of and follow the tips of cyber safety. Although the internet has made many things easier at the same time it has posed many security risks too, if not used properly.
Cybersafety refers to the safe and responsible use of the internet to ensure the safety and security of personal information and not posing threat to anyone else information.

Top 5 Cyber Crime Safety And Security Tips -:

Here we will discuss some cyber security and safety tips that will let us know how to prevent cyber crime? and learn more solutions to cyber crime. we mention some tips:-
  1. identity protection while using the internet
  2. many ways website track you 
  3. Confidentiality of information and strong password
  4. Avoid using public computers
  5. Carefully handles Emails

1) Identity Protection While Using The Internet -:

Identity theft is a type of fraud that involves using someone else's identity to steal money or gain other benefits.when we give out private data like filling up some forms, online payment, then they can be used for harmful reasons like hacking, stalking, and identity fraud.
A most common solution to this private browsing like incognito browsing opens up a browser that will not track your activities. If you are entering data like bank detail into the browser.

2) Many Ways Websites Track You -:

Whenever you visit a website, your web browser may reveal your location via your device's IP address. It can also provide your search and browsing history etc. Which may be used by third parties, like advertised or criminal. This way website tracks you. This generally includes -:

-IP Address -: IP address is a unique address of your device when you connect to the internet.it's likely that your computer shares your IP address with the other networked devices in your office. Your geographical location can be determined by your IP address, any website that you are accessing can determine your rough location.

-Cookies And Tracking Script -: Cookies are small pieces of information that a website can store in your browser. When you sign-in to your online banking website, a cookie remembers your login information. When you change a setting on a website, a cookie store that setting so it can persist across page loads and sessions. For example, you change the zoom percentage of your webpage then this setting will reflect on all opened pages because this was stored in cookies.

3) Confidentiality Of Information And Strong Password-: 

The Internet is a public platform. The sites you visit, the things you search on it, the posts that you put on social networking sites all visible to the public. But there must be some information like your credit history or bank details, your mail, etc. which you do not want to make public i.e. you want to keep this information confidential.
If you visited any website and fill forms like sign up, log in, personal, bank details, etc then you create a powerful password include capital letter alphabet, numeric symbols, etc. Due to a strong password,  your chances of getting hacked are less and your personal information is safe.

4) Avoid Using Public Computers -:

If you need to work on public computers then make sure following things -:
1) Don't save your login password.
2) Avoid entering sensitive information onto public computers.
3) Properly log out before you leave the computers.
4) Erase history and cookies.

5) Carefully Handles Email -:

While opening an email, make sure that you know the sender. even if you open the email message by accident, make sure not to open an attachment in an email from an unrecognized source. Also, your mail might contain a link to a legitimate-looking website, never click on any link inside an email. The link might look legit but it may take you to a fraudulent site. Even if you need to visit the linked website, type the URL of the website on your own in the address bar of a web browser but never open any link by clicking inside an email or by copying its link.