top of page

SQL - Managing Data


Here's a continuation of my review of Getting Started with SQL, an O'Reilly guide by Thomas Nield, last blogged about on January 26, 2017 .

Chapter 10 is entitled Managing Data.

In this chapter we see how to insert data directly into a table. So a command like this one:

INSERT INTO ATTENDEE (FIRST_NAME, LAST_NAME) VALUES ('Stefani','Germanotta')

Specifies a table, fields in that table, and then on the next line the values to be added.

Not that in this example the VIP field for which the command did not specify a value, has a zero because that is the default value of the field specified when the table was created.

We can also use a command in the following format to insert data from one table into another, but keep in mind the data must be transferred between fields of the same type, and any fields in the receiving table that are designated 'NOT NULL' must be accounted for.

INSERT INTO ATTENDEE (FIRST_NAME, LAST_NAME, PHONE, EMAIL) SELECT FIRST_NAME, LAST_NAME, PHONE, EMAIL FROM SOME_OTHER_TABLE

If you want to delete data from a table along specified parameters, you can use this command:

DELETE FROM STATION_DATA WHERE YEAR IS 2002 AND MONTH IS 12

The SQL command to change the case of a field is as follows:

UPDATE ATTENDEE SET LAST_NAME = UPPER(LAST_NAME)

To remove a table from a database simply use the DROP command this format:

DROP TABLE ROOM


Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page