SQL stands for Structured query language. There is 4 basic query statements we use to do common functions. These basic statement will help you to construct data for unit testing in database.
1. Select
2. Insert
3. Update
4. Delete
The SELECT statement is used to select data from a database.
SELECT * FROM your_table_name;
the above query is used to select the values from table - your_table_name
The INSERT INTO statement is used to insert new records in a table.
INSERT INTO table_name (column-1, column-2, column-3,...)
VALUES (value-1, value-2, value-3,...);
The above statement is used to insert value-1, value2 etc to insert in column-1 , column-2 etc in table_name table.
The UPDATE statement is used to update records in a table.
UPDATE your_table_name
SET column-1=value-1, column-2=value-2,...
WHERE column-3=given_value
The above statement is used to update column-1 and column-2 values to value-1 and value-2 for only those rows which have column-2 values equal to given_value
The DELETE statement is used to delete records in a table.
DELETE FROM your_table_name
WHERE column-3=given_value
The above statement will delete all those rows from your_table_name which have column-3 values equal to given_value.
0 comments:
Post a Comment