Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 typical SQL job interview quiz

Author  Topic 

ceecee17
Starting Member

1 Post

Posted - 2013-05-06 : 16:49:35
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)

7020 Posts

Posted - 2013-05-06 : 17:31:02
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

52326 Posts

Posted - 2013-05-07 : 00:17:45
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

982 Posts

Posted - 2013-05-07 : 00:37:12
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
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2013-05-07 : 05:28:53
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

982 Posts

Posted - 2013-05-07 : 06:31:04
hahahaa....i need a gun!
Go to Top of Page
   

- Advertisement -