You are on page 1of 5

List built-in functions:

L1=[‘a’,’b’,’c’,’d’]
1. len(L1)
2. L1=list()
3. L1.append(Element to be appended)
4. L1.extend(L2)
5. L1.insert(index,value)
6. L1.count(the element whose count is to be printed)
7. L1.index(element whose index is to be printed)
8. L1.remove(element to be removed) - 1st occurence
9. L1.pop() or L1.pop(index)
10. L1.reverse()
11. L1.sort()
12. L2=sorted(L1)
13. min(L1)
14. max(L1)
15. sum(L1)

Dictionary : Methods and built in function


D={1:”a”, 2:”b”,3:”c”}
1. len(D)
2. C=dict()
3. D.keys( )
4. D.values( )
5. D.items( )
6. D.clear()
7. D.pop() or D.pop(key)
8. D.update(D2)
9. D.get(1)
10.
a. del D
b. del D[1]

range(10,1,-2)

Dictionary programs
1. Search for a key
2. Search for a value
3. Merge 2 Dictionaries
4. Delete an element
5. To create a new dictionary from a list of keys
6. To create a dictionary with the condition specified from an
existing dictionary
7. Delete all occurrences of a value in the dictionary
8. Minimum value
9. Maximum Value
10. Create a list of tuples from the dictionary with the key and
value as one tuple

MySQL
Revision
1. Database
2. DBMS
3. RDBMS
4. Cardinality
5. Degree
6. Advantages of MySQL
7. Data types in MySQL
8. NULL value
9. Candidate key
10.Alternate Key
11.Meta data
12. Data dictionary
13. Constraints
14.Differentiate between the following
a. DDL and DML
b. Char and Varchar
c. Primary Key and Foreign Key
d. Data Redundancy and Data Inconsistency
e.
SQL Operators
1. Arithmetic Operators - +,-,*,/
2. Relational/Comparison Operators - < ,>,<=,>=,=,<>
3. Logical Operators – and, or, not
4. Special Operators – BETWEEN, IS NULL, LIKE, IN, DISTINCT
5. Aggregate Operators – COUNT(), MIN(), MAX(), SUM(), AVG()

mysql> - MySQL prompt

1. CREATE DATABASE dbname;


Eg :
CREATE DATABASE school;
- Used to create a database.

2. USE dbname;
Eg:
USE school;
- To go inside the database (Eg: school) .

3. SHOW DATABASES;
 To display all the databases in MYsql.
4. SHOW TABLES;
 To display all the existing tables in the database.

5. CREATE TABLE tablename( attributename1 datatype constraint,


attributename2 datatype constraint, ……,attributenameN datatype
constraint);
Eg:
CREATE TABLE student(rno int(5) PRIMARY KEY NOT NULL,
name VARCHAR(25),TOTAL int);

6. DESCRIBE tablename;
Or
DESC tablename;
Eg:
DESC student;
- To describe or display the structure of the table.

7.
8.
CREATE TABLE student1(rno int primary key,name
VARCHAR(30),DOB DATE,TOTALMARKS DECIMAL(6,3));

INSERT INTO student1 VALUES(9,”VYSHAKH”,”2006-04-11”,400);


INSERT INTO student1 values(6,”ARUN”,”2006-09-11”,420);

Select * from EMPLOYEE;


Select EmpNo,salary FROM EMPLOYEE;
Select EmpNo,Ename,Bonus from EMPLOYEE;
SELECT EmpNo as “Employee Number”,DeptId as “Department ID” from
EMPLOYEE;

Select EName as Name , Salary*12 as “Annual Salary” from EMPLOYEE;


SELECT EmpNo, Salary, DISTINCT DeptId from employee WHERE
SALARY>15000;

SELECT RollNumber,SName,DISTINCT SDateofBirth FROM STUDENT


WHERE RollNumber<=10;

UPDATE EMPLOYEE SET SALARY =50000 WHERE deptid=”D02”;


DELETE FROM EMPLOYEE WHERE BONUS IS NULL;

You might also like