SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 typical SQL job interview quiz
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ceecee17
Starting Member

1 Posts

Posted - 05/06/2013 :  16:49:35  Show Profile  Reply with Quote
Just wanted to help the people out there that do not know anything about SQL like me!


Sample Tables:
employee (Table)

emp_ID fname lname dept_ID
----------- ------ ------- -----------
1 John Doe 3
2 Jane Doe 2
3 Ron Smith 3
4 Nancy King 4
5 James Monroe 1
6 Lisa Jones 0


department (Table)

dept_ID dept_name
----------- ------------------------------
1 Sales
2 Customer Service
3 Accounting
4 Marketing
5 Purchasing



Write the SQL required to do the following:


1. Add a new department named Janitorial Services whose department ID is 6.







2. Modify the database to reflect that Ron Smith has changed jobs and now works in the Sales Department.




3. Retrieve the last name and department name of all employees whose last name begins with A through J.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 05/06/2013 :  17:31:02  Show Profile  Reply with Quote
How does that help people that "do not know anything about SQL".

Why would people that "do not know anything about SQL" be in a SQL job interview?







CODO ERGO SUM
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 05/07/2013 :  00:17:45  Show Profile  Reply with Quote
these are simple straightforward query scenarios. Have a look at link below and understand INSERT, UPDATE, SELECT synatxes which will help you out
http://msdn.microsoft.com/en-us/library/ms174335.aspx
http://msdn.microsoft.com/en-us/library/40e63302-0c68-4593-af3e-6d190181fee7
http://msdn.microsoft.com/en-us/library/dc85caea-54d1-49af-b166-f3aa2f3a93d0

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

waterduck
Aged Yak Warrior

Malaysia
964 Posts

Posted - 05/07/2013 :  00:37:12  Show Profile  Reply with Quote
Hi,
3. Retrieve the last name and department name of all employees whose last name begins with A through J.

is the answer as below?
WHERE ASCII(UPPER(lname)) > 64 AND ASCII(UPPER(lname)) < 75)
Go to Top of Page

Transact Charlie
Flowing Fount of Yak Knowledge

United Kingdom
3451 Posts

Posted - 05/07/2013 :  05:28:53  Show Profile  Visit Transact Charlie's Homepage  Reply with Quote
Are you joking?

WHERE lname LIKE '[A-J]%'



Transact Charlie
Msg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.
http://nosqlsolution.blogspot.co.uk/
Go to Top of Page

waterduck
Aged Yak Warrior

Malaysia
964 Posts

Posted - 05/07/2013 :  06:31:04  Show Profile  Reply with Quote
hahahaa....i need a gun!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000