The preferred method for modifying your data within a database is T-SQL. While the last Fundamentals post showed how to use the GUI to get that done, it’s not a very efficient mechanism. T-SQL is efficient.
UPDATEThe command for updating information in your tables is UPDATE. This command doesn’t work the same way as the INSERT statement. Instead of listing all the columns that are required — meaning columns that don’t allow for NULL values — you can pick and choose the individual columns that you want to update. The operation over-writes the information that was stored in the column with new information. In addition to defining the table and columns you want to update, you have to tell SQL Server which rows you’re interested in updating. This introduces the WHERE clause to the T-SQL statements you’re learning. The WHERE clause is used in DELETE and SELECT statements, as well. You can choose to leave the WHERE clause off, but then you’ll be updating all values in the table.
No comments:
Post a Comment