Professional Documents
Culture Documents
6. Which command is used to add a new column Address into the table
7. Which command to used to change data/values in a table suppose we have to increase the
marks of Rahul by 5.
Update student
Alter table is DDL command , used to add ,modify, drop column in a table
9. Which command is used to delete the records from table
Sum(), min(),max(),count(),avg()
17. Which clause is used to search for NULL values in any column?
Ans: IS NULL
Ans: it is used for gropuing of rows and for condition with group by clause having will be used in
place of where.
Mysql.connector,connect(host=’localhost’,userid=’1234’,password=’1234’,database=’school’)
Ans: is_connected()
Mysql.connector.is_connected()
5. Define cursor?
Ans: Cursor Is A Control Structure Used To retrieve row by row processing of records in
resultset
Ans: Execute()
7. What is resultset?
Ans: it refers to logical set of records that are fetched from database by executing a query and
made available to application program
Ans: fetchone() : it will return one record from resultset as a tuple. If there is no record
then it will return none.
Fetchmany(n): it will return n records and if there is no record then it will return none.
9. Which object of cursor is used to count no. Of rows retrieved from cursor?
Ans: row count
Cursor.rowcount
10. To save changes made in database permanently , you need to run connection._______
method.
Ans: commit()
Cursor is executing the sql statement using execute function which will create table in mysql
named student with columns rollno, name , marks and clas
12. Explain the given statement:
Cur.execute( "insert into student values ({},'{}',{},{})".format(rno, name, clas,
marks”;)
Cursor is executing the sql statement using execute function which will insert the record by
passing parameterized query (run time)using {} and format()
DataFile Handling:
w- add in file if file is there then it will delete previous data and add new i.e overwrite the
existing file
Ans: .py
List, string and tuple are example of sequence as they supports indexing