Sunday, August 3, 2014

oDesk mysql test answer 2014


Q - what is the name of the utility used to extract NDB configuraion information
A - ndb_config

Q - transactions and commit/rollback are supported by mysql using the myisam engine
A – False

Q18.Examine the data in the employees table given below:
last_name department_id salary
ALLEN 10 3000
MILLER 20 1500
King 20 2200
Davis 30 5000
Which of the following Subqueries will execute well?
a. SELECT * FROM employees where salary > (SELECT MIN(salary) FROM employees GROUP BY department_id);
b. SELECT * FROM employees WHERE salary = (SELECT AVG(salary) FROM employees GROUP BY department_id); c. SELECT distinct department_id FROM employees Where salary > ANY (SELECT AVG(salary) FROM employees GROUP BY department_id);
d. SELECT department_id FROM employees WHERE SALARY > ALL (SELECT AVG(salary) FROM employees GROUP BY department_id);
e. SELECT department_id FROM employees WHERE salary > ALL (SELECT AVG(salary) FROM employees GROUP BY AVG(SALARY));

Q - what will happen if two tables in a database are named rating and RATING
A - c. This is possible on UNIX/LINUX and not on Windows platform

Q - what is NDB
A - storage engine

Q - what privileges do you need to create a function in mysql
A - CREATE ROUTINE Q - Which of the following relational database management systems is simple to embed in a larger program
A – Both

Q13.Which of the following statements are true?
a. Names of databases, tables and columns can be up to 64 characters in length
b. Alias names can be up to 255 characters in length
c. Names of databases, tables and columns can be up to 256 characters in length
d. Alias names can be up to 64 characters in length

Q - What is wrong with the following query
A – Answer A – In the subquery ‘*’

Q17.Which one of the following correctly selects rows from the table myTable that have NULL in column column1?
a. SELECT * FROM myTable WHERE column1 IS NULL
b. SELECT * FROM myTable WHERE column1 = NULL
c. SELECT * FROM myTable WHERE column1 EQUALS NULL
d. SELECT * FROM myTable WHERE column1 NOT NULL
e. SELECT * FROM myTable WHERE column1 CONTAINS NULL

Q - how can a innodb database be backed up without locking the tables
A – mysqldump --single-transaction db_name

Saturday, October 30, 2010

zend with wamp

Setting up WAMP for Zend Framework Projects
A ZF project would not run out of the box on a fresh installation of WAMP. The purpose of this guide is to act as a checklist for the experienced, and a step by step guide for the more inexperienced. Before we start, this article is written based on WampServer 2.0i with Zend Framework 1.10. If you are using earlier versions, the steps should work, but you might want to consider upgrading to the newest.
1. Make sure Wamp is running ok
2. Enable virtual hosts, mod_rewrite, and override in ‘httpd.conf’
3. Set up virtual host in ‘httpd-vhosts.conf’
4. Check include paths for the Zend library
5. Add Custom URLs in host file
1. Make sure Wamp is running ok
Navigate to http://localhost on your favorite browser, you should see the WampServer welcome screen with headings “Server Configuration”, “Tools”, “Your projects” etc. If not, check your Wamp installation before proceeding further.
2. Enable virtual hosts, mod_rewrite, and override in ‘httpd.conf’
For a default 2.0i installation, the apache configuration file can be found at ‘C:\wamp\bin\apache\Apache2.2.11\conf’. After making a backup, open it in notepad and search for “vhosts”. Make sure the line
# Include conf/extra/httpd-vhosts.conf
is uncommented by removing the “#” in front.
Next, look for the line
# LoadModule rewrite_module modules/mod_rewrite.so
and uncomment it too.
Lastly, look for

Options FollowSymLinks
AllowOverride None
Order deny,allow
# Deny from all

and make sure AllowOverride is set to All instead of none. This prompts Apache to apply rules found in the .htaccess files in sub directories. Save and close.
3. Set up virtual host in ‘httpd-vhosts.conf’
Look for the file in ‘C:\wamp\bin\apache\Apache2.2.11\conf\extra’. Make a copy for backup and open it in notepad. The file should already have 2 dummy entries which you can safely remove. Now we will add the default virtual host and your own custom host:
NameVirtualHost 127.0.0.1:80


ServerAdmin webmaster@localhost
DocumentRoot "c:\wamp\www"
ServerName localhost
ServerAlias localhost
ErrorLog "C:\wamp\logs\apache_error.log"
CustomLog "C:\wamp\logs\access.log" common

Note: replace the parameters below with your own project paths.

ServerAdmin admin@customurl.localhost
DocumentRoot "C:\My\Project\Path\public"
ServerName customurl.localhost
ServerAlias customurl.localhost
ErrorLog "C:\My\Project\Path\logs\apache_error.log"
CustomLog "C:\My\Project\Path\logs\access.log" common

Update: if you get a “You don’t have permission to access” error when accessing the page, include the following directive right before the
tag:

allow from all

4. Check include paths for the Zend library
Your app probably runs alright now. If you are getting the file not found error when including the Zend library, make sure you have copied the Zend library into your /library folder and your index.php actually combines it with the PHP include path:
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path()
)));
Edit: As Fernando pointed out, take note to use slashes “\” instead of back slashes “/” on windows. Also, include your custom urls in your host file if they are not a subdomain of localhost:
5. Add Custom URLs in host file
Your host file is located at ‘C:\Windows\System32\drivers\etc’. Its a file without extension, but you can open it with notepad just the same. Add the following line to the end:
127.0.0.1 [Custom URL here]
That’s it. If you are unsure of the steps or meet any other problems feel free to email me. Tested using WampServer 2.0i with Zend Framework 1.10.

Note : 1- If you are under windows, you have to put the paths with this “/” bar.
For example, in this lines:
DocumentRoot “c:\wamp\www”
ErrorLog “C:\wamp\logs\apache_error.log”
CustomLog “C:\wamp\logs\access.log” common
change it like this:
DocumentRoot “c:/wamp/www”
ErrorLog “C:/wamp/logs/apache_error.log”
CustomLog “C:/wamp/logs/access.log” common
Otherwise, the apache server won’t start.
2- For virtualhosts, apart of changing “httpd-vhosts.conf”, you have to set the hosts file of the OS.
Path -> C:\Windows\System32\drivers\etc\hosts
something like this:
127.0.0.1 customurl # customurl ZF project