Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Tuesday, September 4, 2012

Mysql Interview questions



1.  How do you start and stop Mysql on Windows?
    Ans- Net start Mysql, net stop Mysql
2.   How do you start Mysql on Linux?
Ans- /etc/init.d/mysql start
3.  Explain the difference between mysql and mysqli interfaces in PHP?
Ans- Mysqli is the object oriented version of mysql library functions.
4.  What’s the default port MySql Server?
Ans- 3306
5.   What does tee command do in Mysql?
Ans- tee followed by a filename turns on MySQL logging to a specified file. It can be stopped by command note.
6.   Can you save your connection settings to a conf file?
Ans- Yes, and name it~/.my.conf. You might want to change the permissions on the file to 600, so that it’s not readable by others.
7.  How do you change a password for an existing user via mysqladmin?
Ans- mysqladmin
-u root –p password “newpassword”
8. Use mysqldump to create a copy of the database?
     Ans- mysqldump –h mysqlhost –u

9.   Have you ever used Mysql Administrator and Mysql Query Brower? Describe the tasks you accomplished with these tools.

10. What are some good ideas regarding user security in MySQL?
Ans- There is no user without a password. There is no user without a user name. There is no user whose Host column contains % .


Sunday, February 12, 2012

MYSQL MCQ For Exam

Chapter-27
1.    MySQL’s storage engines, namely
A.    ARCHIVE
B.     Index
C.     XLS,
D.     InnoDB
E.     MyISAM.
Ans: A,D,E
2.    A relational database  ___________ is a data structure used to store and organize information.
A.    View
B.    Table
C.    Report
D.    Stored Procedure
Ans: B
3.    MyISAM tables handle transactions, meaning that you should use this type for all
of your transactional needs, so as not to incur the extra overhead required of transactional.
A.    True 
B.    False
Ans: B
4.    Which command use to view storage engine list?
A.    View Engine
B.    Show Storage
C.    Show Engine
Ans: C

5.    How Do I Convert ISAM Tables to MyISAM Tables?
A.    MODIFY TABLE table_name TYPE=MYISAM;
B.    ADD  TABLE table_name TYPE=MYISAM;
C.    ALTER TABLE table_name TYPE=MYISAM;
Ans: C   
6.    What is the maximum size of the VARCHAR Column type?
A.    255 Byte
B.    255 Characters
C.    512 Byte
D.    512 Characters
Ans: B
Chapter-28
1.    How the Privilege System Works?
A.    Authentication
B.    Grant
C.    Revoke
D.    Authorization
Ans: A, D
2.    ___________Determines whether a user is even allowed to connect to the server.
A.    Authentication
B.    Authorization
Ans: A
3.    Where Is Access Information Stored?
A.    MySQL Datbase
B.    User Database
C.    User Define Database
Ans: A
4.    Which mysql command use to drop a user?
A.    DROP  from user jason@localhost;
B.    Delete from  user jason@localhost;
C.    Delete user jason@localhost;
D.    DROP user jason@localhost;
Ans: D.
5.    Which mysql command use to rename user?
A.    CHANGE USER jason@localhost TO jasongilmore@localhost
B.    RENAME  USER jason@localhost;
C.    RENAME USER jason@localhost TO jasongilmore@localhost
Ans: C
Chapter- 30
1.    What are the key features of MySql extension?
A.    Object oriented:
B.    T Embedded Client support
C.    Transactional support:
Ans: A, C

2.    Which Method use to select MySql Database?
A.    mysqli__db (mysqli link, string dbname)
B.    mysqli_select_database (mysqli link, string dbname)
C.    mysqli__database (mysqli link, string dbname)
D.    mysqli_select_db (mysqli link, string dbname)
Ans: D

3.    Which function is responsible for closing the connection?
A.    mysql_Exit (mysqli link)
B.    mysql_close (mysqli link)
C.    mysql_Nothing (mysqli link)
Ans: B
4.    What is the diference between mysqli_fetch_object (mysqli_result result) and mysqli_fetch_array (mysqli_result result)?
A.    mysqli_fetch_object  except that an object is returned rather than an array.
B.    Both Function are similar
C.    mysqli_fetch_object  except that an any value is returned rather than an array.
Ans: A
5 . commit method commits the present transaction to the database, returning TRUE on success and FALSE otherwise.
A.    True B. False
Ans: A
Chapter – 31
1.    A set of SQL statement stored in the database and executed by calling an assigned name within a query in known as What?
A.    Stored Routine
B.    Stored Function
C.    Stored Tables
D.    View
Ans: A
2.    Stored routines have a number of advantages
A.    Consistency
B.    Performance
C.    Reference integrity
D.    Security
Ans: A, B, C
3.    MySQL actually implements two procedural variants, which are collectively referred to as stored routines are
A.    Stored Function
B.    Trigger
C.    Views
D.    Stored Procedure
Ans: A, D
4.    Which stored Routine  support execution of SQL commands such as SELECT, INSERT, UPDATE, and DELETE?
A.    Stored Function
B.    Trigger
C.    Views
D.    Stored Procedure
Ans: D.
5.    How to create a stored Routine?
A.    CREATE Stored Routine get_inventory()
Select * from Student

B.    CREATE PROCEDURE get_inventory()
Select * from Student
C.    CREATE Routine  get_inventory()
Select * from Student
D.    Make  PROCEDURE get_inventory()
Select * from Student
Ans: B
Chapter- 32

1.    Which of the following statement is true about trigger?
A.    A trigger is a task that executes in response to some predetermined event
B.    A set of SQL statement stored in the database and executed by calling an assigned name
C.    consists of a set of rows that is returned if a particular query is executed
Ans: A

2.    A After trigger shouldn’t be used to enforce propagation or referential integrity, because it’s possible that other before triggers could execute after it.
A.    True B. False   Ans: B

3.    Which command produces several attributes for a trigger or set of triggers?
A.    SHOW TRIGGERS
B.    VIEW TRIGGERS
C.    DISPLAY TRIGGERS
Ans: A
4.    Which statement use to delete triggers?
A.    DROP TRIGGER table_name.trigger_name
B.    TRIGGER table_name.trigger_name
C.    DELETE TRIGGER table_name.trigger_name
Ans: A

5.    Which of the following statement is correct?
A.    Views are supported: A trigger can be used in conjunction with a view.
B.    Transactions are not supported: A trigger can’t be involved in the beginning or conclusion of a transaction.
C.    Result sets can be returned from a trigger:
Ans: B
Chapter-33
1.    Which of the following statement is true about View?
A.    A View is a task that executes in response to some predetermined event
B.    A set of SQL statement stored in the database and executed by calling an assigned name
C.    consists of a set of rows that is returned if a particular query is executed
Ans: C
2.  What are the advantageous of View?
A. Simplicity
B. Security
C. Performance
D. Transaction
Ans: A,B

3. Which of the following example of creating a view?
                         A. Make A  VIEW employee_contact_info_view AS
  SELECT first_name, last_name, email, phone
  FROM employee ORDER BY last_name ASC;
B.    CREATE VIEW employee_contact_info_view AS
 SELECT first_name, last_name, email, phone
 FROM employee ORDER BY last_name ASC;
C.    CREATE employee_contact_info_view  from
 SELECT first_name, last_name, email, phone
FROM employee ORDER BY last_name ASC;

Ans: B

4. Which statement use to show the view structure?
A. DISPLAY  employee_contact_info_view;
B. DESC employee_contact_info_view;
C. DESCRIBE employee_contact_info_view;
               Ans: C
5. WITH CHECK OPTION clause will prevent any subsequent view update from changing any value in the column to anything other than Columbus.
A. True B. False
Ans: A


Chapter- 34 & 35
1.    Which of the following statement are correct?
A.    The SQL subquery is a separate SELECT statement that is embedded in the main statement and may be executed once for each row of the result set.
B.    cursor, such as its scrolling behavior and the query used to build the result set on which the cursor operates
C.    MySQL’s database indexing and full-text search capabilities, and shows you how to execute Web-based database searches using PHP
D.    All of Them
Ans: D
2.    How to create a cursor?
A.    Create cursor_name CURSOR FOR select_statement
B.    DECLARE cursor_name CURSOR FOR select_statement
C.    cursor_name CURSOR FOR select_statement
D.    DECLARE  CURSOR  cursor_name  FOR select_statement
Ans: B


3.    For example, to limit returned query results to just the first five rows, construct the following query:
A.    SELECT name, price FROM product ORDER BY name ASC MIN 5;
B.    SELECT name, price FROM product ORDER BY name ASC LIMIT 5, 15;
C.    SELECT name, price FROM product ORDER BY name ASC LIMIT 5;
D.    SELECT name, price FROM product ORDER BY name ASC LIMIT 5,0;
Ans: C
4.    _____________________ is essentially an ordered (or indexed) subset of table columns, with each row entry pointing to its corresponding table row
A.    View  B. An index C. Stored Routine D. Trigger      Ans: B
5.    What are the Advantages of MySql Database Index?
A.    Uniqueness
B.    Query Optimization
C.    Text Searching
D.    Database table search
Ans: A,B,C
Chapter- 36 & 37
1.    Which of the following statement is true about Transaction?
A.    A View is a task that executes in response to some predetermined event
B.    A set of SQL statement stored in the database and executed by calling an assigned name
C.    consists of a set of rows that is returned if a particular query is executed
D.    A transaction is an ordered group of database operations that are perceived as a single unit
Ans: D
2.    What is the  four pillars of the transactional process ?
A.    Performance    B. Atomicity C. Consistency D.Isolation E.Durability  Ans: B,C,D,E
3.    Which statement, a command that is executed much like a query is executed within the mysql client, is used to import delimited text files into a MySQL table?
A.    LOAD DATA INFILE
B.    IMPORT DATA INFILE
C.     DATA INFILE
D.    ADD DATA INFILE
Ans: A
4.    Which SQL statement is actually a variant of the SELECT query. It’s used when you want to direct query output to a text file?
A.    QUERY  INTO OUTFILE   B . ADD INTO OUTFILE C. INTO OUTFILE  D. SELECT INTO OUTFILE
Ans: D
5.    The ________________is really just a command-line version of the LOAD DATA INFILE SQL query.
A.    mysqlimport client  B. SELECT INTO OUTFILE C. LOAD DATA INFILE     

Ans: A

Sunday, June 26, 2011

ICDL Mudules05 Questions Answer

Q01. What is Database? What is the benefit of using database?
Answer:
Database is a collection of information concerning a certain topic or business application. Databases help us organize related information in a logical fashion for easy access and retrieval.
Benefits of using database are as follows-
Ø  We can store data in a defined structure
Ø  Data can be stored in a variety of forms, from simple lines of text (names and addresses) to complex data (pictures, sounds and video images)
Ø  Data can be turned into useful information
Ø  Database enables the user to add or extract data easily
Ø  Database helps presenting the data in useful ways.
Ø  From a relational database we get information from different tables simultaneously.
Ø  Using Access database we can make report, queries, forms etc.

Q02. Write the difference between data and information.
Answer:
Data refers to discrete items. In contrast, information involves linking together two or more items of data to provide an item or knowledge of meaning.
Data
-        Facts, statistics used for reference or analysis
-        Numbers, characters, symbols, images etc. which can be processed by a computer
-        Data must be interpreted by a human or machine to derive meaning
Information
-        Information is interpreted data
-        Data that has been processed to produce meaning

Q03. Write the common uses of database.
Answer:
Databases are used to group and format data and then extract information from the data. Examples of uses of databases include-
-        Airline booking system
-        Government records, e.g., tax details are kept on a government database
-        Bank account records
-        Hospital patient details. Patient records are kept on a database within the health system.
-        Phone directories
-        Criminal databases used by the police to keep track of known criminals

Q04. Describe the functions of different users of database.
Answer:
Different groups of people design, maintain and use large scale databases-
v  Database Designers: These are highly skilled database professionals with an in-depth knowledge of exactly how the database works, including its overall function and details programming.
v  Database Administrators: This group administers the day to day operation of the database and make sure that the data is kept secure. These provide technical backup to users of the database.
v  Database Users: The users are responsible for routine, day to day data entry, data maintenance and information retrieval.

Q05. What is relational database?
Answer:
Relational database
A relational database is able to store and manipulate data across multiple tables unlike a single table database. By utilizing multiple tables, a relational database reduces unnecessary duplication of data. For example, for a large database to store customer information, only the unique address needs to be recorded each time when we add a new customer.

Q06. Describe the use of different data types of access.
The use of different data types of access are as follows-
Data Type
Description
Text
Alphanumeric characters up to 255 characters in length. Can be used for text, or text and numbers that are not used in calculations
Memo
Alphanumeric characters (maximum of 65,535 characters) and can store text with rich text formatting (.rtf)
Number
Numeric values including fractional or integers. Used for numbers likely to be used in calculations but not for Currency type data
Date/Time
Dates and times values.
Currency
Monetary values, (with or without a currency symbol)
AutoNumber
A unique and sequential number inserted automatically each time a new record is added
Yes/No
Yes/No, True/False value (ticked is Yes, un-ticked equals No)
OLE Object
Used for storing OLE objects from other Microsoft Windows Applications
Hyperlink
Used for storing hyperlinks to provide access to web pages or files using a single click
Attachment
Pictures, Images, Binary files, Office files. Storage size limited to 700kb
Lookup Wizard…
Starts a Lookup Wizard to create a Combo box to look up values

Q07. Write the steps to create a table/Relationship/Query/Form/Report in Access 2007.
Answer:


Q08. What are validation rule and validation text?
Answer:
Validation Rule
Validation rule is an expression that limits the values that can be entered in the field. Data entered must match the given conditions to be accepted. 

Validation Text
Validation text is the error message that appears when we enter a value prohibited by the validation rule.

Q09. Explain the five logical operators of access.
Answer:
The following table contains logical operators used to combine two values and return a true, false or null result-
Operator
Usage
Description
And
Expr1 And Expr2
True when Expr1 and Expr2 are true.
Or
Expr1 Or Expr2
True when either Expr1 or Expr2 is true.
Eqv
Expr1 Eqv Expr2
True when both Expr1 and Expr2 are true or both Expr1 and Expr2 are false.
Not
Not Expr
True when Expr is not true.
Xor
Expr1 Xor Expr2
True when either Expr1 is true, or Expr2 is true, but not both.

Tuesday, May 24, 2011

Database and Computing


Databases are used daily by large corporations, small businesses and individuals, often without people realizing they are using a database. Even something as simple as entering contact details into the “Contact” or Address Book’ section of an email client such as Microsoft Outlook/ Outlook Express, involves entering data into a database.

Data entered will generally be alphabetical (Names/Address) or numerical (Dates/ Currency),however Access is also able to store other forms of data, such as links to websites, documents created in other package as well as file attachments.

Data:
-Facts, statistics used for reference or analysis.
-Numbers, characters, symbols, images etc, which can be process by a computer
-Data must be interpreted, by a human or machine, to derive meaning

Information:
-Information is interpreted data
-Data that has been processed to produce meaning.

What is a database?
Generally, the word database is a computer term for a collection of information concerning a certain topic or business application. Databases help you organize this related information in a logical fashion for easy access and retrieval. Databases aren’t only for computers. There are also manual databases we simply refer to these as manual filing systems or manual databases systems. These filing systems usually consist of people, paper, folders, and filing cabinets- paper is the key to a manual database system.

An access database is nothing more than an automated version of the filing and retrieval functions of a paper filing system. Access databases store information in a carefully defined structure. Access tables store data in a variety of forms, from simple lines of text to complex data such as pictures, sound, or video images. Storing data in a precise, known format enables a database management system (DBMS) like Access to turn data into useful information. Table serves as the primary data repository in an Access database. Queries, forms, and reports provide access to the data, enabling a user to add and presenting the data in useful ways.