SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

SQL Homework – August 2017 – Create a table

If you didn’t see it last month I’ve started doing monthly SQL Homework. The first month was backups, this month it’s tables.

Here is your homework for August!

  1. Create a table with at least 3 columns.
  2. Add 5 rows to the table.
  3. Add one column to the table.
  4. Update the existing 5 rows to fill in the new column.
  5. Modify the new column to not allow NULLs.
  6. Run a query against the table, pulling the columns in reverse order.

 
Here is how the grading will go.
Note: If you can, and have done any/all of this recently then give yourself the points. This is about ability not necessarily doing it this time. Be sure you can do it before actually giving yourself the points though.
Note: Additional points are granted in some cases. If it says T-SQL that means you wrote the T-SQL yourself and didn’t use the GUI to generate the SQL.

  • 25 pts – Create the table. (+10 for T-SQL)
  • 10 pts – Add the rows to the table. (+5 if you can do it in a single command)
  • 10 pts – Add the column. (+5 for T-SQL)
  • 10 pts – Update the values of the new columns to not be null.
  • 10 pts – Change the new column to not allow NULLs. (+5 for T-SQL)
  • 10 pts – Run the query.

Filed under: Microsoft SQL Server, SQL Homework, SQLServerPedia Syndication, T-SQL Tagged: microsoft sql server, SQL Homework, T-SQL

SQLStudies

My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.

Comments

Leave a comment on the original post [sqlstudies.com, opens in a new window]

Loading comments...