5/3/13

QTP Test Process Videos

,
QTP Test Process Videos

  QTP Test Process
I) Planning 

a)  Get Environment Details (UI design technology and database) from Development team 

b) Analyze the AUT in terms of Object Identification 

c) Select Areas or Test cases for Automation Tool settings Configuration & 

d) Globalize Automation Framework Implementation




II) Generating Basic Tests 

 a) Object Repository based Test Design 
          1) Recording 
          2) Keyword Driven methodology 

b) Descriptive Programming/programmatic Descriptions
         1) Static Programming 
         2) Dynamic Programming Hybrid Approach 

 III) Enhancing Tests 

 1) Inserting Checkpoints (QTP) (9+3) 

 2) Inserting Output values (QTP) (7)

 3) Parametrization (QTP, VBS) 

4) Synchronization (QTP, VBS)
Read more →

3/26/13

SQL

,
SQL (Structured Query Language)

What is SQL?

SQL stands for Structured Query Language and Certified by ANSI (American National Standards Institute) and ISO.

SQL was developed by IBM in 1970’s, the first name of SQL is Sequel

Some common relational database management systems that use SQL are: Oracle, Sybase, Microsoft SQL Server, MYSQL, MS Access Etc… Although most database systems have their own extensions.

Purpose of SQL:

•    SQL Creates New Databases

•    SQL Creates new tables in a database

•    SQL inserts records in a database

•    SQL Updates records in a database

•    SQL Retrieves data from a Database

•    SQL deletes records in a database

•    SQL can set permissions on tables



Who Learn SQL:



• Database Developers

• Database Testers

• Database Administrators

Sub sets of SQL:

SQL has three major components:

Data Definition Language (DDL),

Data Manipulation Language (DML),

Data Control Language (DCL).

Data Definition Language (DDL):
 

The Data Definition Language (DDL) is used to create and destroy databases and database objects.

DDL Commands are:

CREATE

USE

ALTER

DROP

Data Manipulation Language (DML):
 

The Data Manipulation Language (DML) is used to insert, modify and retrieve database information.

DML Commands are:

INSERT

SELECT

UPDATE

DELETE

Data Control Language (DCL):
 

Data Control Language (DCL)  allows database administrators to configure security access to relational databases.

DCL Commands are:
 
GRANT

DENY

REVOKE
Read more →

2/6/13

SDLC Models

,
SDLC Models

Overview:
There are several SDLC models to streamline the Software Development Process. Each model has its own advantages and disadvantages; and it depends on the organization to adopt the most appropriate one for the project. Sometimes a combination of models may be more suitable.
 of developing software from its inception to its final release and maintenance is known as Software Development Life Cycle (SDLC).

1.0    Classification of SDLC models

SDLC models can be broadly classified as below.

i.    Sequential models

a.    Waterfall model
b.    V-Model

ii.    Incremental/Iterative models

a.    Prototype model
b.    Spiral Model
c.    Agile Model

1.1    Sequential Models


In these models, Software development process is sequential and the development progresses through a number of well defined phases.
 

1.1.1 Waterfall Model

Overview

Waterfall model was launched in 1970’s and it was the first process model to be introduced and followed widely in Software development process. In this model, after each phase is finished, it proceeds with the next one. Thus the phases are strictly time sequenced and reviews may occur before moving to the next phase which allows for the possibility of changes.
Waterfall model has the following phases.



a.    Requirements Gathering

This is the first and most important phase. During this phase, requirements are gathered from the end-user by consultation; these requirements are analyzed and documented in an understandable form. Finally, a Requirement Specification document is created which serves the purpose of guideline for the next phase of the model.
These are the overall Business Requirements and it becomes input to prepare Software Requirements in next phase.

b.    System requirements

In this phase, business requirements are analyzed for their validity and the possibility of incorporating the requirements in the system to be developed is also studied. The requirements are documented which is called as System Requirements Specification (SRS) document and this becomes input to the Design Phase.

c.    Design

During the Design phase, High level and Low level designs are created based on SRS document. This helps in defining overall system architecture and detailed implementation of each component. These design specifications serve as input for the next phase of the model.

d.    Coding

During this phase, based on the design documents, the work is divided into modules/units and actual coding is started. Developers create programs for each module which are integrated into a complete system to check if all modules/units coordinate between each other and the system as a whole behaves as per the specifications. The output of this phase is software built according to a pre-defined coding standard and unit tested to satisfy the system architecture requirements.

e.    Testing

In this phase, Testers test the developed software to ensure that the system meets/satisfies the requirements. If there is any mismatch or deviation, testers report defects. These defects are analyzed and fixed by the developers. Testers validate the defect fixes and close them by performing confirmation testing (Regression Testing). After completion of the testing, the software is released to production/customers.

f.    Release and Maintenance
Release team installs software in customer environment and ensures correct and complete installation of the system.
Maintenance team processes customer issues based on service agreements. Also, the maintenance phase is never ending phase or very long phase. Generally, problems (which are not found during the development life cycle) with the system come up once the users start using it. Not all the problems come in picture directly but they arise time to time and needs to be solved. These are addressed by the Maintenance team.

Advantages of waterfall model

i.    The main strength of the waterfall model is its simplicity.
ii.    Easy to manage due to the rigidity of the model. Each phase has specific deliverables and a review process.
iii.    Phases are processed and completed one at a time.
iv.    Works well for smaller projects where requirements are very well understood.

Disadvantages of waterfall model

i.    Once an application is in the testing stage, it is very difficult to go back and change something that was not well-thought out in the concept stage.
ii.    No working software is produced until late during the life cycle.
iii.    The sequential nature of communication among the phases can introduce inordinate delays in resolving the problems.
iv.    High amounts of risk and uncertainty.
v.    Poor model for long and ongoing projects.
vi.    Not suitable for the projects where requirements are at a moderate to high risk of changing.

When to use waterfall model

i.    Requirements are very well known, clear and fixed.
ii.    Product definition is stable.
iii.    Technology is understood.
iv.    There are no ambiguous requirements
v.    Ample resources with required expertise are available freely
vi.    The project is short.


1.1.2    V-Model

Overview

V-model means Verification and Validation model. V-model may be considered as extension of Waterfall model, because just like Waterfall model it is a well structured     model in which the different phases progress in a sequential or linear way.
In the Waterfall model, testing is considered as a post-development (after coding) activity. Each phase must be completed before the next phase begins and different types of testing apply at corresponding phase of development. Thus from testing perspective, the type of tests at each phase of development vary significantly.


The various phases of the V-model are as follows:

a. Business Requirements and Acceptance testing

At this level, overall business requirements are collected by analyzing the needs of the customer(s). This phase is concerned about establishing what the ideal system has to perform and however, it does not determine how the software will be built. The requirements cover hardware, software, and operational requirements. These requirements are documented in Business requirement specification document which the Business analysts use to communicate their understanding of the system back to the users. This serves the guideline for System Requirement specification.
For overall business requirements, eventually whatever software is developed should fit into and work as per these requirements and should be accepted by the customers, in their environment. This testing is called Acceptance testing for which the tests are designed based on the business requirements.

b.  Software Requirements and System testing

Based on the BRS document, Software Requirements are created and documented in SRS document. These requirements are created by Technical managers/Senior Developers and figure out the possibilities and techniques using which the business requirements can be implemented. If any of the requirements is not feasible, it is informed to the customers and the BRS document is modified accordingly once the resolution is found.
At this level, Testers create test cases based on SRS document in order to perform System testing. Entire System is tested before the software is deployed in customer’s environment. This is to ensure that all the software requirements are satisfied by the system that is developed. This testing of the entire software system can be called as System Testing.

c. High Level Design and Integration testing

System Architect/Senior Developer creates high level design based on the SRS document. High level design document typically consists of the overall architecture of the system, list of modules/subsystems, brief functionality of each module and their interface relationships, dependencies etc.
As per the high-level design, the system is being made up of interoperating and integrated modules/subsystems and these individual modules should be integrated and tested together before full system testing is done. This level of testing is called Integration Testing.

d. Low Level Design and Component testing
 

High Level design gets translated to a more detailed or low-level design. The low level design document will contain detailed information like algorithm choices, table layouts, database elements, processing logic, exception conditions, and so on. This result in the identification of number of components and each component is developed in appropriate programming language.
The components that are the outputs of the low-level design have to be tested independently before being integrated. Thus the testing at this level is known as component testing.

Advantages of V-model

i.    Testing activities like planning, test designing happens well before coding. This saves a lot of time. Hence higher chance of success over the waterfall model.
ii.    Supports wide range of Development methodologies such as structured and object oriented systems development.
iii.    Proactive defect tracking that is defects are found at early stage.
iv.    Avoids the downward flow of the defects.
v.    Works well for small projects where requirements are easily understood.

Disadvantages of V-model

i.    Very rigid and least flexible.
ii.    It is an expensive model compared to waterfall model as it needs lot of resources, budget and time.
iii.    Software is developed during the implementation phase, so no early prototypes of the software are produced.
iv.    If any changes happen in midway, then the test documents along with requirement documents has to be updated.
v.    Adoption of changes in requirements and adding new requirements at the middle of the process is difficult.

When to use V-model
i.    The V-shaped model should be used for small to medium sized projects where requirements are clearly defined and fixed.
ii.    The V-Shaped model should be chosen when ample technical resources are available with needed technical expertise.

Read more →

2/4/13

Software Development Life Cycle

,
SDLC (Software Development Life Cycle)

1.0    Software Development Life Cycle (SDLC)

During 1950’s and 1960’s, softwares were developed without any systematic approach and because of which many softwares failed to perform as intended once they are released. This led to follow a systematic way to deliver Quality software and is known as SDLC.
The Process of developing software from its inception to its final release and maintenance is known as Software Development Life Cycle (SDLC).

2.0    Phases in SDLC
SDLC is made up of several phases to manage the software development activities.

a.    Requirements Gathering
b.    Analysis and Planning
c.    Software Design
d.    Coding/Implementation
e.    Testing
f.    Release and Maintenance

2.1    Requirements Gathering

During this phase, the specific requirements of the software to be developed are gathered and documented. Requirements gathering are done differently for Software Application and Software Product as described below.

a.    Software Application

 
Business Analyst gathers requirements from the customers and documents them in BRS (Business Requirements Specification) document

b.    Software Product
 

Business Team gathers requirements from model customers, explores competitor products and prepares PRD (Product Requirement Document) or BRD (Business Requirement Document)
In either case, it is important to ensure that right requirements are captured. BRS or BRD document acts as a bridge between the customer and the designers who develop the software.
BRS or BRD document is sent to Project Manager for Review and Approval. Output of this phase is finalized BRS or BRD document.

2.2    Analysis and Planning

During this phase, Technical manager creates SRS (Software Requirements Specification) document by analyzing BRS document and Project Manager creates Project Plan.

2.2.1    Analysis

Technical Manger analyzes BRS document in terms of below factors

a.    Are they complete requirements?
b.    Are they correct requirements?
c.    Are they achievable requirements?
d.    Are they Testable requirements?

After analyzing the BRS document, Technical Manager creates SRS document which consists of two sub documents.

i.    FRS (Functional Requirement Specification) that describes the functionalities to be developed
ii.    SRS (System Requirement Specification) that describes Software and Hardware to be used.

During this process Technology Manager focuses on Technology selection based on the following factors.

a.    Technical factors
i.    Nature of the application
ii.    Organization’s experience
 

b.    Business factors
i.    Cost/Budget (Open source softwares or Licensed softwares)
ii.    Customer interests

2.2.2    Planning

Planning is done to come up with a schedule, the scope and resource requirements for a release. Project Manager creates the plan that explains how the requirements will be met and by which time. Project plan also contains the scope of the requirements (what will be met and what will not be met) for the project, resource availability.
Project Manager also analyzes the risks involved and contingency plan for them. Finally he comes up with the milestones and release date for the project.
Output of this phase is SRS document and Project Plan

2.3    Software Design

During this phase, System architect or Senior developer creates Software Design Document (SDD) based on the SRS document from the Analysis phase.
The purpose of this phase is to figure out how to satisfy the requirements explained in System Requirements Specification (SRS) document.
Design is usually split into two levels

a.    High Level Design (HLD) or Global Design that contains the overall architecture of the system.
 

b.    Low Level Design (LLD) or Detailed Design that contains internal architecture of each and every unit/component/module.

Software Design Document (SDD) produced during this phase will be used by the development team to produce the programs.

2.4    Coding/Implementation
During this phase, based on the Design documents Developers develop/implement programs by following the coding standards in the chosen programming language. In addition to coding, this phase also involves the creation of documentation for the software being developed.
Output of this phase is code documents and software that meets the requirements.

2.5    Testing

Software, developed during coding phase, is subjected to testing.
Earlier Developers themselves were testers and there are no separate test teams to test the softwares. Now-a-days, in order to improve Quality of the software, most of the organizations have separate Testing teams to test the softwares.
During this phase, Testers test the software based on the SRS document to check if the requirements are met or not.  If there is any mismatch, defects are reported.
Developers again fix the Defects and testers confirm the defect fixes and close them.
Output of this phase is Tested Software and Test documents.

2.6    Release and Maintenance

2.6.1    Release

Once the software is tested, it is released to the customers.
The released software needs to be deployed in production environment and this is generally done by the Release team (consists of few developers, testers, project management executive and system administrator).  Project Manager forms the Release Team.
If required, Release team provides necessary training to the customers.

2.6.2    Maintenance

As the users/customers start using the software in their environments, they may identify defects which need to be addressed. Thus the software now enters into maintenance phase where in the software is modified to satisfy the changes raised by the customers.
The maintenance activities are performed by the maintenance team (consists of few developers, testers, project management executive) that is formed by Project Manager.
Software Maintenance is of three types as described below

a.    Modifications

i.    Corrective changes – Defects found during production phase require emergency fixes or corrective changes as these are not identified during the Testing phase.
 

ii.    Enhancements – If customer wants new functionalities to be added to the current system then they are considered as Enhancements.

b.    Migration – Migrating the software from old technology to new technology.
Example: Migrating software from MS Access to SQL Server/Oracle

c.    Retirement – Retiring the old system and developing new system
Example: Changing II-Tier Application to Web application
Read more →

1/29/13

MySQL Interview Questions

,
MySQL Interview Questions

Q.General Information About MySQL

MySQL is a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server.
MySQL is free software. It is licensed with the GNU GENERAL PUBLIC LICENSE http://www.gnu.org/.

Q.MYSQL is a database management system.

A database is a structured collection of data. It may be anything from a simple shopping list to a picture gallery or the vast amounts of information in a corporate network. To add, access, and process data stored in a computer database, you need a database management system such as MySQL. Since computers are very good at handling large amounts of data, database management plays a central role in computing, as stand-alone utilities, or as parts of other applications.

Q.MySQL is a relational database management system.

A relational database stores data in separate tables rather than putting all the data in one big storeroom. This adds speed and flexibility. The tables are linked by defined relations making it possible to combine data from several tables on request. The SQL part of MySQL stands for "Structured Query Language" - the most common standardized language used to access databases.

Q.MySQL is Open Source Software.

Open source means that it is possible for anyone to use and modify. Anybody can download MySQL from the Internet and use it without paying anything. Anybody so inclined can study the source code and change it to fit their needs. MySQL uses the GPL (GNU General Public License) http://www.gnu.org, to define what you may and may not do with the software in different situations. If you feel uncomfortable with the GPL or need to embed MySQL into a commercial application you can buy a commercially licensed version from us.

Q.Why use MySQL?

MySQL is very fast, reliable, and easy to use. If that is what you are looking for, you should give it a try. MySQL also has a very practical set of features developed in very close cooperation with our users. You can find a performance comparison of MySQL to some other database managers on our benchmark page. See section 12.7 Using Your Own Benchmarks. MySQL was originally developed to handle very large databases much faster than existing solutions and has been successfully used in highly demanding production environments for several years. Though under constant development, MySQL today offers a rich and very useful set of functions. The connectivity, speed, and security make MySQL highly suited for accessing databases on the Internet.

Q.The technical features of MySQL

For advanced technical information, see section 7 MySQL Language Reference. MySQL is a client/server system that consists of a multi-threaded SQL server that supports different backends, several different client programs and libraries, administrative tools, and a programming interface. We also provide MySQL as a multi-threaded library which you can link into your application to get a smaller, faster, easier to manage product. MySQL has a lot of contributed software available.
It is very likely that you will find that your favorite application/language already supports MySQL. The official way to pronounce MySQL is ``My Ess Que Ell'' (not MY-SEQUEL). But we try to avoid correcting people who say MY-SEQUEL.

Q.How do you return the a hundred books starting from 25th?

SELECT book_title FROM books LIMIT 25, 100. The first number in LIMIT is the offset, the second is the number.

Q.You wrote a search engine that should retrieve 10 results at a time, but at the same time you’d like to know how many rows there’re total. How do you display that to the user?

SELECT SQL_CALC_FOUND_ROWS page_title FROM web_pages LIMIT 1,10; SELECT FOUND_ROWS(); The second query (not that COUNT() is never used) will tell you how many results there’re total, so you can display a phrase "Found 13,450,600 results, displaying 1-10". Note that FOUND_ROWS does not pay attention to the LIMITs you specified and always returns the total number of rows affected by query.

Q.How would you change a column from VARCHAR(10) to VARCHAR(50)?

ALTER TABLE techpreparation_questions CHANGE techpreparation_content techpreparation_CONTENT VARCHAR(50).

Q.How would you delete a column?

ALTER TABLE techpreparation_answers DROP answer_user_id.

Q.How do you offload the time/date handling to MySQL?

SELECT DATE_FORMAT(techpreparation_timestamp, ‘%Y-%m-%d’) from techpreparation_questions; A similar TIME_FORMAT function deals with time.

Q.How do you convert between Unix timestamps and MySQL timestamps?

UNIX_TIMESTAMP converts from MySQL timestamp to Unix timestamp, FROM_UNIXTIME converts from Unix timestamp to MySQL timestamp.

Q.What does tee command do in MySQL?

tee followed by a filename turns on MySQL logging to a specified file. It can be stopped by command note.

Q.Can you save your connection settings to a conf file?

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.

Q.Explain advantages of MyISAM over InnoDB?

Much more conservative approach to disk space management - each MyISAM table is stored in a separate file, which could be compressed then with myisamchk if needed. With InnoDB the tables are stored in tablespace, and not much further optimization is possible. All data except for TEXT and BLOB can occupy 8,000 bytes at most. No full text indexing is available for InnoDB. TRhe COUNT(*)s execute slower than in MyISAM due to tablespace complexity.

Q.What are HEAP tables in MySQL?

HEAP tables are in-memory. They are usually used for high-speed temporary storage. No TEXT or BLOB fields are allowed within HEAP tables. You can only use the comparison operators = and <=>. HEAP tables do not support AUTO_INCREMENT. Indexes must be NOT NULL.

Q.What does "tee" command do in

"tee" followed by a filename turns on MySQL logging to a specified file. It can be stopped by command notee.

Q.Explain about database design?

Database design is also called as Data modeling. It is used for long-term management of database. This process is used to store information and to keep data for long term. Creating an efficient structure helps you to channelize information into good channels.

Q.Can you save your connection settings to a conf file?

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.

Q.what is difference between candidate key and primary key

Any attribute that is uniquely identify a row in a table is candidate key for the table. We select one of the candidate key as Primary key. All candidate keys which are not chosen as primary key are Alternate keys. The key which uniquely identify the rows of the table and which is made up of more than one attribute is called Composite key. Generally a candidate key becomes the primary key of the table. If the table has more than one candidate key one of them will become the primary key and the rest are called alternate keys

Q.Explain the difference between mysql and mysqli interfaces in PHP?

mysqli is the object-oriented version of mysql library functions.

Q.How do you change a password for an existing user via mysqladmin?

mysqladmin -u root -p password "newpassword"

Q.Explain the difference between BOOL, TINYINT and BIT.

Prior to MySQL 5.0.3: those are all synonyms. After MySQL 5.0.3: BIT data type can store 8 bytes of data and should be used for binary data.

Q.Explain data type TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

The column exhibits the same behavior as a single timestamp column in a table with no other timestamp columns.
TIMESTAMP : The TIMESTAMP type, like DATETIME, stores date-and-time values, but has a different range and some special properties that make it especially suitable for tracking data modification times. MySQL displays TIMESTAMP values using the same format as DATETIME values; that is, 'YYYY-MM-DD hh:mm:ss'. The TIMESTAMP data type in MySQL is special in that you can cause a TIMESTAMP column to be initialized or updated automatically to the current date and time without explicitly assigning it a value. It's important to know about the automatic initialization and update properties of TIMESTAMP. These properties make TIMESTAMP columns useful for tracking record modification times, but can be a source of confusion if you're not aware of them.
DEFAULT : The DEFAULT value clause in a data type specification indicates a default value for a column. With one exception, the default value must be a constant; it cannot be a function or an expression. This means, for example, that you cannot set the default for a date column to be the value of a function such as NOW() or CURRENT_DATE. The exception is that you can specify CURRENT_TIMESTAMP as the default for a TIMESTAMP column as of MySQL.
CURRENT_TIMESTAMP : CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW(). NOW() Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a string or numeric context. (There is no .uuuuuu part before MySQL 4.1.13.) The value is expressed in the current time zone. E.g. select now();

Q.How do you start and stop MySQL on Windows?

net start MySQL, net stop MySQL

Q.State two considerations which can improve the performance of MYSQL?

Two considerations which can improve the performance of MYSQL are as follows: -
1) Fixed length fields take up more space than variable length fields but they are a bit faster.
2) Size of the field should be restricted to the smallest possible value based upon the largest input value.

Q.What Is "mysqladmin" in MySQL?

"mysqladmin" is a command-line interface for administrators to perform server administration tasks. It support a number of commonly used commands like:
"mysqladmin shutdown" - Shuts down the server.
"mysqladmin ping" - Checks if the server is alive or not.
"mysqladmin status" - Displays several important server status values.
"mysqladmin version" - Displays version information of the server.
"mysqladmin create databaseName" - Creates a new database.
"mysqladmin drop databaseName" - Drops an existing database.

Q.How To Create a New View in MySQL?

You can create a new view based on one or more existing tables by using the "CREATE VIEW viewName AS selectStatement" statement as shown in the following script:
mysql> CREATE TABLE comment (faqID INTEGER,
message VARCHAR(256));
Query OK, 0 rows affected (0.45 sec)
mysql> INSERT INTO comment VALUES (1, 'I like it');
Query OK, 1 row affected (0.00 sec)
mysql> CREATE VIEW faqComment AS SELECT f.id, f.title,
f.description, c.message FROM faq f, comment c
WHERE f.id = c.faqID;
Query OK, 0 rows affected (0.06 sec)
mysql> SELECT * FROM faqComment;

Q.Explain about normalization?

Applying specific rules (normal forms) to the database is the primary process. These rules should be applied in the order specified starting with the first normal form. These rules should be adhered by every database they are
1)Each column should have only one value
2)Repeating columns of data cannot be done.

Q.How we can count duplicate entery in particular table against Primary Key ? What are constraints?

The syntax in the previous answer (where count(*) > 1) is very questionable. suppose you think that you have duplicate employee numbers. there's no need to count them to find out which values were duplicate but the followin SQL will show only the empnos that are duplicate and how many exist in the table:
Select empno, count(*)
from employee
group by empno
having count(*) > 1
Generally speaking aggregate functions (count, sum, avg etc.) go in the HAVING clause. I know some systems allow them in the WHERE clause but you must be very careful in interpreting the result. WHERE COUNT(*) > 1 will absolutely NOT work in DB2 or ORACLE. Sybase and SQLServer is a different animal.

Q.How do you start MySQL on Linux?

/etc/init.d/mysql start

Q.Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

#include
#include
int main(void) {
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
/* Change me */
char *server = "localhost";
char *user = "root";
char *password = "PASSWORD";
char *database = "mysql";
conn = mysql_init(NULL);
/* Connect to database */
if (!mysql_real_connect(conn, server,
user, password, database, 0, NULL, 0)) {
fprintf(stderr, "%s ", mysql_error(conn));
exit(1);
}
/* send SQL query */
if (mysql_query(conn, "show tables")) {
fprintf(stderr, "%s ", mysql_error(conn));
exit(1);
}
res = mysql_use_result(conn);
/* output table name */
printf("MySQL Tables in mysql database: ");
while ((row = mysql_fetch_row(res)) != NULL)
printf("%s ", row[0]);
/* close connection */
mysql_free_result(res);
mysql_close(conn);
return 0;
}

Q.Explain about MyISAM table?
This feature is a default type for tables. This table is not so much considered for transactions because it is not considered as safe but this kind of table is very fast in execution. The maximum key length is 1024 bytes and 64 keys per table. Size of this table entirely depends upon the operating system.

Q.Explain about the time stamp field?
TIMESTAMP filed occurs when an INSERT and UPDATE field occurs when there is no value specified for the field. There are many behaviors for TIMESTAMP field and it depends upon the version of MYSQL.

Q.How To Present a Past Time in Hours, Minutes and Seconds?
If you want show an article was posted "n hours n minutes and n seconds ago", you can use the TIMEDIFF(NOW(), pastTime) function as shown in the following tutorial exercise:
SELECT TIMEDIFF(NOW(), '2006-07-01 04:09:49') FROM DUAL;
06:42:58
SELECT TIME_FORMAT(TIMEDIFF(NOW(), '2006-06-30 04:09:49'),
'%H hours, %i minutes and %s seconds ago.') FROM DUAL;
30 hours, 45 minutes and 22 seconds ago.

Q.How Many SQL DML Commands Are Supported by "mysql"?
There are 4 SQL Data Manipulation Language (DML) commands that are supported by "mysql". They are listed below with short descriptions:
"INSERT INTO tableName ..." - Inserts new data rows into the specified table.
"DELETE FROM tableName ..." - Deletes existing data rows from the specified table.
"UPDATE tableName SET ..." - Updates existing data rows in the specified table.
"SELECT expressionList FROM ..." - Selects rows from tables and returns rows of values resulted from the specified expression list.

Q.How Do You Know If Your MySQL Server Is Alive?
If you want to know whether your MySQL server is alive, you can use the "mysqladmin" program in a command window as shown in the following tutorial:
>cd mysqlin
>mysqladmin -u root ping
mysqld is alive
The "mysqld is alive" message tells you that your MySQL server is running ok. If your MySQL server is not running, you will get a "connect ... failed" message.

Q.How To Present a Past Time in Hours, Minutes and Seconds?
If you want show an article was posted "n hours n minutes and n seconds ago", you can use the TIMEDIFF(NOW(), pastTime) function as shown in the following tutorial exercise:
SELECT TIMEDIFF(NOW(), '2006-07-01 04:09:49') FROM DUAL;
06:42:58
SELECT TIME_FORMAT(TIMEDIFF(NOW(), '2006-06-30 04:09:49'),
'%H hours, %i minutes and %s seconds ago.') FROM DUAL;
30 hours, 45 minutes and 22 seconds ago.

Q.How To Concatenate Two Character Strings?
If you want concatenate multiple character strings into one, you need to use the CONCAT() function. Here are some good examples:
SELECT CONCAT('Welcome',' to') FROM DUAL;
Welcome to
SELECT CONCAT('ggl','center','.com') FROM DUAL;

Q.What Is "mysqlcheck"?
"mysqlcheck" is a command-line interface for administrators to check and repair tables. Here are some sample commands supported by "mysqlcheck":
"mysqlcheck databaseName tableName" - Checks the specified table in the specified database.
"mysqlcheck databaseName" - Checks all tables in the specified database.
"mysqlcheck --all-databases" - Checks all tables in all databases.
"mysqlcheck --analyze databaseName tableName" - Analyzes the specified table in the specified database.
"mysqlcheck --repair databaseName tableName" - Repairs the specified table in the specified database.

Q.Collapse/Expand Answer of Question How To Include Numeric Values in SQL statements?
If you want to include a numeric value in your SQL statement, you can enter it directly as shown in the following examples:
SELECT 255 FROM DUAL; -- An integer
255
SELECT -6.34 FROM DUAL; -- A regular number
-6.34
SELECT -32032.6809e+10 FROM DUAL; -- A floating-point value
-3.20326809e+014

Q.How To Enter Characters as HEX Numbers?
If you want to enter characters as HEX numbers, you can quote HEX numbers with single quotes and a prefix of (X), or just prefix HEX numbers with (0x). A HEX number string will be automatically converted into a character string, if the expression context is a string. Here are some good examples:
SELECT X'313233' FROM DUAL;
123
SELECT 0x414243 FROM DUAL;
ABC
SELECT 0x46594963656E7465722E636F6D FROM DUAL;

Q.What Happens If NULL Values Are Involved in Expressions?
If NULL values are used in expressions, the resulting values will be NULL values. In other words:
Arithmetic expressions with NULL values result NULL values.
Comparison expressions with NULL values result NULL values.
Logical expressions with NULL values result NULL values.
The tutorial exercise shows you some interesting examples:
SELECT NULL + NULL FROM DUAL;
NULL
SELECT NULL + 7 FROM DUAL;
NULL
SELECT NULL * 7 FROM DUAL;
NULL
SELECT NULL = NULL FROM DUAL;
NULL
SELECT 0 < NULL FROM DUAL;
NULL
SELECT '' > NULL FROM DUAL;
NULL
SELECT NULL AND TRUE FROM DUAL;
NULL
SELECT NULL OR TRUE FROM DUAL;
1
This is contradicting against the rules!

Q.How To Convert Numeric Values to Character Strings?
You can convert numeric values to character strings by using the CAST(value AS CHAR) function as shown in the following examples:
SELECT CAST(4123.45700 AS CHAR) FROM DUAL;
4123.45700
How to get rid of the last 2 '0's?
SELECT CAST(4.12345700E+3 AS CHAR) FROM DUAL;
4123.457
SELECT CAST(1/3 AS CHAR);
0.3333
--Very poor conversion

Q.What Is InnoDB?

InnoDB is a transaction safe storage engine developed by Innobase Oy (an Oracle company now).

Q.How To Use CASE Expression?
There are 2 ways to use the CASE expression. The first way is to return one of the predefined values based on the comparison of a given value to a list of target values. The second way is to return one of the predefined values based on a list of conditions. Here is the syntax of both types of CASE expressions:
CASE value WHEN target_value THEN result
WHEN target_value THEN result
WHEN target_value THEN result
...
ELSE result
END
CASE WHEN condition THEN result
WHEN condition THEN result
WHEN condition THEN result
...
ELSE result
END
The tutorial exercise below gives two good examples:
SELECT CASE 'Sun' WHEN 'Mon' THEN 'Open'
WHEN "Fri" THEN "Open" ELSE 'Closed' END FROM DUAL;
Closed
SELECT CASE WHEN HOUR(CURRENT_TIME())<9 br="" losed="" then="">WHEN HOUR(CURRENT_TIME())>17 THEN 'Closed'
ELSE 'Open' END FROM DUAL;
Closed

Q.How To Enter Microseconds in SQL Statements?
If you want to enter microseconds in a SQL statements, you can enter them right after the time string as a 6-digit number delimited with '.'. '0' will be padded to right if not enough digits. Here are some good examples:
SELECT TIME('1997/01/31 09^26^50.123') FROM DUAL;
09:26:50.123000
SELECT TIME('1997/01/31 09^26^50.000123') FROM DUAL;
09:26:50.000123

Q.What Is Commit?

Commit is a way to terminate a transaction with all database changes to be saved permanently to the database server.

Q.How To Start MySQL Server?

If you want to start the MySQL server, you can run the "mysqld" program in a command window as shown in the following tutorial:
>cd mysqlin
>mysqld
"mysqld" will run quietly without printing any message in you command window. So you will see nothing after entering the "mysqld" command. You should trust "mysqld" and believe that MySQL server is running ok on your local computer now.
Another way to start the MySQL server is double-click mysqlinmysqld.exe on your file explorer window.

Q.How To Decrement Dates by 1 in MySQL?
If you have a date, and you want to decrement it by 1 day, you can use the DATE_SUB(date, INTERVAL 1 DAY) function. You can also use the date interval subtraction operation as "date - INTERVAL 1 DAY". The tutorial exercise below gives you some good examples:
SELECT DATE_SUB(DATE('1997-03-01'), INTERVAL 1 DAY)
FROM DUAL;
1997-02-28
SELECT DATE('1997-01-31') - INTERVAL 1 DAY FROM DUAL;
1997-02-28
Read more →