Giter VIP home page Giter VIP logo

code-examples's Introduction

##code-examples

Instructions

This is exercise meant to be a validation of fundamental knowledge of basic concepts. Unfortunately, too many candidates who claim to have expert level knowledge of web application development fail to grasp the basics. This should be trivially easy for those with actual skills.

  1. Fork this repo.
  2. Provide answers to tasks in the form of new code & comments.
  3. Commit your code
  4. If you want to keep your submission in a private repo, add thajosh to the repo as a member with view access.

Task 1

Explain what the code in admin.php does, line by line, in plain, concise english. Identify as many bugs as you can and why they are bugs.

Context: A page called login.php asks for a username and password. If the password is correct, it redirects the user to admin.php.

Task 1 Answer: commit updated admin.php with your comments

Task 2

Given the table below, improve the structure of this database (adjust fields, data format, tables, order, field types, etc).

Hint: you should have more than one table.

CREATE TABLE employee_info (
  id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  username VARCHAR(64),
	email1 VARCHAR(64),
	email2 VARCHAR(128),
	password VARCHAR(14),
	company_name VARCHAR(128),
	company_phone CHAR(11),
	company_address VARCHAR(128),
	job_title CHAR(256),
	salary VARCHAR(10),
	permission_level VARCHAR(32),
	is_permission_level_active VARCHAR(10),
	start_date VARCHAR(11)
);

Answer should be a new "CREATE TABLE" script.

SQL for creating table does not have to include data, just structure.

Sample output from employee_info table:

Employees
id, username, email1, email2, password, company_name, company_phone, company_address, job_title, salary, permission_level, is_permission_level_active, start_date
37, JohnSmith, [email protected], [email protected], 764efa883dda1e11db47671c4a3bbd9e, ACME Inc, 555-2323, 123 Acme Way, Director, $100,000, admin, true, 2012-02-23
39, JaneSmith, [email protected], NULL, 153c2c618d157c4a3ba08e23a06b70d7, ACME INC, 555-2323, 123 ACME WAY, VP, $120,000, user, true, 99-03-19
40, ChrisSmith, [email protected], NULL, 34921ae7e3079e44e0ee2f96d8ee6e87, Example Dot Com, 555-1234, 456 Example Lane, Manager, $60,000, user, false, 2010-8-4
42, KateSmith, [email protected], NULL, dbe39d9d56f98d5f9cb22df15b285791, Example Dot Com, 555-1234, 456 Example Lane, Sr Manager, $80,000, admin, false, 2004-12-24

Task 2 Answer: commit a new file db.sql with your SQL statement(s)

Task 3

After improving the database, write a raw sql statement that gets the username, first email, start_date, salary, and company_name for all active admins from your new database format.

This should be written in SQL, not PHP.

Task 3 Answer: commit a new file fetch.sql with your SQL statement(s)

code-examples's People

Contributors

famtastic-fritz avatar thajosh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.