Page 106 - PYTHON-12
P. 106

74.  What is Primary key?
           Ans.  Primary key is a column or a combination of columns that uniquely identify a row in a relational table.
            75.  What is Candidate key?
           Ans.  All possible combinations of columns that can possibly serve as the primary key are called candidate keys.
            76.  What is Foreign key?
           Ans.  A combination of columns where values are derived from primary key of some other table is called the foreign
               key of the table in which it is contained.
            77.  What is Alternate key?
           Ans.  A candidate key that is not serving as a primary key is called an Alternate key.
            78.  What is MySQL?
           Ans.  MySQL is an open-source RDBMS that relies on SQL for processing data in the database. The database is
               available for free under the terms of General Public Licence (GPL).
            79.  What is RDBMS?
           Ans.  Relational Database Management System (RDBMS) facilitates access, security and integrity of data and
               eliminates data redundancy, for example, MySQL, Oracle, Microsoft SQL Server, etc.
            80.  Differentiate between Drop and Delete command.
           Ans.  Drop command is used to delete tables, for example, Drop Table Orders; while Delete command is
               used to delete rows of a table, for example, Delete from Student;
            81.  What do you understand by NOT NULL constraint?
           Ans.  This constraint ensures that the NULL values are not permitted on a specified column. This constraint can be
               defined at the column level and not at the table level.
            82.  What is the significance of COUNT() function in MySQL?
           Ans.  It is used to count the number of non-null values in a given column or number of non-null rows in a table, for
               example, Select Count (RollNo) from students;
                If we use the asterisk, we get all rows, including nulls and duplicates, for example, Select Count(*)

               from students;
            83.  How can we add a record and add a column in a table?
           Ans.  We can add a record by using INSERT INTO command and a column through the ALTER table command.
            84.  Differentiate between DDL and DML commands.
           Ans.  DDL (Data Definition Language) is used to change the structure of the table while DML (Data Manipulation
               Language) is used to retrieve records from the table.
                Examples of DDL commands are – ALTER , CREATE, DROP.
                Examples of DML commands are – SELECT, INSERT INTO, DELETE.
            85.  Give the necessary command to incorporate SQL interface within Python.
           Ans.  import MySQLdb
            86.  To establish a connection between Python and SQL database, connect() is used. Which argument(s) may not
               necessarily be given while calling connect()?
           Ans.  database name
            87.  Which of the functions gives the result as a string when applied while reading contents from a text file in
               Python?
           Ans.  read() and readline()
            88.  After executing any DML command from Python in Python-MySQL connectivity, which method/statement is
               necessary to execute in order to make the changes permanent in MySQL?
           Ans.  commit()
            89.  Which function is used to open a connection with MySQL database from within Python using mysql.connector
               package?
           Ans.  connect()
            90.  After establishing database connection, which database object is created so that the SQL query may be
               executed through it to obtain result set?
           Ans.  cursor


          A.34                                                           Computer Science with Python–XII
   101   102   103   104   105   106   107