1. Question:Write the examples for the following mysql commands on the table. a) SHOW b) CREATE c) INSERT d) UPDATE e) SELECT f) ALTER g) DESC h) DESCRIBE i) DROP j) DELETE 

    Answer
    a) example:
     mysql> show tables;
    
    b) example:
    mysql>create table book(
        id int(10) not null auto_increment primary key,
        title varchar(50) not null,
        author varchar(50)
    );
    
    c) example:
    mysql>insert into book(title,author)values('MySQL','Mikel Jone');
    
    d) example:
    mysql>update book set title='Advanced MySQL' where id=1;
    
    e) example:
    mysql>select id, title, author from book;
    
    f) example:
    mysql>alter table book add column isbn varchar(20);
    
    g) example:
    mysql>desc book;
    
    h) example:
    mysql>describe book
    
    i) example:
    mysql>drop table book;
    
    j) example:
    mysql>delete from book where id=3;






    1. Report
  2. Question:What is transaction? 

    Answer
    A transaction is an ordered group of database operations that are treated as a single unit. Successful transaction will be committed and unsuccessful transaction will be rolled back.






    1. Report
  3. Question:What is cursor? Why is it used? 

    Answer
    Iterating through a result set.  Known as a cursor, it allows us to retrieve each row in the set separately and perform multiple operations on that row without warring about affecting other rows in the set.






    1. Report
  4. Question:What is the difference between primary key and unique? 

    Answer
    The PRIMARY KEY attribute is used to guarantee uniqueness for a given row. No values residing in a column designated as a primary key are repeatable or nullable within that column whereas a column assigned the UNIQUE attribute will ensure that all values possess distinct values, excenpt that NULL values are repeatable.






    1. Report
  5. Question:What are the advantages of stored routine? 

    Answer
    Stored routines have a number of advantages, which are:
    1. Consistency
    2. Performance
    3. Security
    4. Architecture






    1. Report
Copyright © 2025. Powered by Intellect Software Ltd