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 are the benefits of using triggers? 

    Answer
    Triggers have many benefits: 
    
    a. Audit trails: Special logging table that lets us quickly tabulate and display the results to an impatient executive.
    b. Validation: We can use triggers to validate data before updating the database. 
    c. Referential integrity enforcement: Table relationships remain stable throughout the lifetime of a project






    1. Report
  3. Question:What are the advantages of using view? 

    Answer
    Views can be quite advantages for a number of reasons:
    
    Simplicity: Saving the hassle of repeatedly querying multiple tables to retrieve this information.
    Security: Quite certain some information is inaccessible to third parties, such as the SSNs and salaries of employees.
    Maintainability: A view abstracts the gory details of a query.






    1. Report
  4. 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
  5. 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
Copyright © 2025. Powered by Intellect Software Ltd