SQL Workshop - Washington University in St. Louis
SQL Workshop
Insert, Update, Delete
Doug Shook
Test Tables
So far we have only read data
When testing code that may change data, it is important to NEVER use the production DB ? Run the statements on test tables before deploying
There are two ways to accomplish this ? Create a copy of the database ? Use the INTO clause
2
SELECT INTO
Create a complete copy of the Invoices table
SELECT * INTO InvoiceCopy FROM Invoices; (114 row(s) affected)
Create a partial copy of the Invoices table
SELECT * INTO OldInvoices FROM Invoices WHERE InvoiceTotal ? PaymentTotal ? CreditTotal = 0; (103 row(s) affected)
These statements create new tables
3
Test Tables
Things to watch out for: ? Only column definitions and data are copied ? Primary keys, indexes, default values, etc. are not included in the new table ? If calculated values are used, you must name the column
To delete a table you can use the DROP TABLE statement
4
INSERT
Creates a new row within a table Two methods:
? Column list ? Ordered values Identity columns should be left off ? Generated by SQL Server ? More on these later
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- sql workshop washington university in st louis
- how to insert update and delete data ligent
- accounts payable user guide abila
- version 1 1 0 administrator s guide kofax
- create table vendor for the embry riddle aeronautical university
- new vendor setup update vendor records form ve sp 01 scottish power
- tungsten network e invoicing new user guide
- vendor faq new york state office of mental health police
- add update or delete vendor contact
- accounts payable training guide cyma
Related searches
- university city st louis mo
- colleges in st louis missouri
- schools in st louis mo
- universities in st louis mo
- places to eat in st louis mo
- best school districts in st louis mo
- top school districts in st louis county
- clinics in st louis mo
- private schools in st louis area
- best school districts in st louis area
- things to do in st louis missouri
- what is open in st louis mo