What is a simple procedure for querying databases
Hi,
I need some explanation in querying a database. How to implement the judgments delete, insert into and update, for querying databases carefully. I am trying to implement some action queries which can return no records. This action queries are responsible for actions such as add and delete and modify records. Any suggestions will be appreciated. Thanks in advance.
Re: What is a simple procedure for querying databases
You can create a delete query that eliminates records from one or multiple of the tables listed in the FROM clause that satisfy the WHERE clause. This query deletes entire records, not delete the contents of a particular field. Its syntax is: DELETE FROM table WHERE criteria. Once the records were deleted using a delete query can not undo this operation. If you want to know what records were deleted, first examine the results of a select query that uses the same approach and then run the delete query. Keep backups of your data at all times. If you delete the wrong entries are retrievable from the backup.
DELETE
FROM
Employees
WHERE
Cargo = 'Seller'
Re: What is a simple procedure for querying databases
INSERT INTO adds a record in a table. It is known as a query of aggregate data. This query can be of two types: Insert a single record in a table or insert the records in another table. To insert a single record. In this case the syntax is: INSERT INTO Table (field1, field2, ..., abc) VALUES (value1, value2, ..., abc). This query recorded in the field1 the value1, and value2 into field2 and so on. To select and insert records into a new table In this case the syntax is: SELECT field1, field2, ..., abcINTO new table FROM [WHERE criteria]. You can use the make-table queries to archive records, make backup copies of the tables or make copies for export to another database or use in reports that display data from a particular time period. For example, you could create a monthly sales reports by region running the same make-table query each month.
Re: What is a simple procedure for querying databases
If you want to insert records records from another table then use the following syntax. INSERT INTO table [IN base_external (field1, field2,, Comp) SELECT TableOrigin.comp1, TableOrigin.comp2,, TableOrigin.compN FROM Table Source. In this case we selected 1,2 ,..., n fields in the source table and will be recorded in the fields 1,2, .., n of the table. The condition can include SELECT WHERE clause to filter the records to be copied. If Source Table Table and have the same structure can simplify the syntax: INSERT INTO SELECT Table .* FROM Table Source Table Source.