Creating Database 2010


Published on

Starting a database

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Creating Database 2010

  1. 1. Database
  2. 2. Stages in Creating a Database <ul><li>Define Business Requirements </li></ul><ul><li>Choosing a Database Platform </li></ul><ul><li>Creating the Database (SQL) </li></ul>
  3. 3. I. Define Business Requirements <ul><li>Types of Databases </li></ul><ul><li>Desktop Databases- oriented toward single-user applications and reside on standard personal computers (Ex. Microsoft Access, FoxPro, FileMaker Pro, Paradox and Lotus Approach) </li></ul><ul><li>Server Databases - geared toward multi-user applications. These databases are designed to run on high-performance servers and carry a correspondingly higher price tag. (Ex. Microsoft SQL Server, Oracle and IBM DB2) </li></ul>
  4. 4. <ul><li>Types of Databases </li></ul><ul><li>(continuation) </li></ul><ul><li>Web-enabled Databases - Nowadays, almost every database application calls for some kind of web interaction. Many people assume that if you're looking to publish your database on the Internet, you need to use a server database. That's not necessarily true -- a desktop database could (inexpensively!) meet your needs </li></ul>
  5. 5. II. Choosing a Database Platform <ul><li>Who will be the users of the database and what tasks will they perform? </li></ul><ul><li>How often will the data be modified? Who will make these modifications? </li></ul><ul><li>Who will be providing IT support for the database? </li></ul>
  6. 6. II. Choosing a Database Platform <ul><li>(continuation) </li></ul><ul><li>What hardware is available? Is there a budget for purchasing additional hardware? </li></ul><ul><li>Who will be responsible for maintaining the data? </li></ul><ul><li>Will data access be offered over the Internet? If so, what level of access should be supported </li></ul>
  7. 7. III. Creating the Database (SQL) <ul><li>Syntax or command in SQL: </li></ul><ul><li>To create a database: </li></ul><ul><li>CREATE DATABASE personnel </li></ul><ul><li>To be sure that we are in the correct database by issuing a USE command: </li></ul><ul><li>USE personnel; </li></ul><ul><li>To create table: </li></ul><ul><li>CREATE TABLE employees …. </li></ul>
  8. 8. III. Creating the Database (SQL) <ul><li>(continuation) </li></ul><ul><li>We can use the ALTER TABLE command to add this attribute to our existing database. We want to store the salary as an integer value. The syntax is quite similar to that of the CREATE TABLE command, here it is: </li></ul><ul><li>ALTER TABLE employees </li></ul><ul><li>ADD salary INTEGER NULL; </li></ul><ul><li>Similarly, the command below would be used to remove the entire employees database: </li></ul><ul><li>DROP DATABASE employees </li></ul><ul><li>to add records to an existing table. INSERT INTO personal_info values('bart','simpson',12345,$45000) </li></ul>
  9. 9. III. Creating the Database (SQL) <ul><li>(continuation) </li></ul><ul><li>To retrieve the specific information they desire from an operational database. Note that the asterisk is used as a wildcard in SQL. This literally means &quot;Select everything from the personal_info table.&quot; SELECT * FROM personal_info </li></ul><ul><li>Finally, the WHERE clause can be used to limit the records that are retrieved to those that meet specified criteria. The CEO might be interested in reviewing the personnel records of all highly paid employees. The following command retrieves all of the data contained within personal_info for records that have a salary value greater than $50,000: SELECT * FROM personal_info WHERE salary > $50000 </li></ul><ul><li>SELECT select_list FROM source WHERE condition(s) GROUP BY expression HAVING condition ORDER BY expression </li></ul>
  10. 10. III. Creating the Database (SQL) <ul><li>(continuation) </li></ul><ul><li>The UPDATE command can be used to modify information contained within a table, either in bulk or individually. Each year, our company gives all employees a 3% cost-of-living increase in their salary. The following SQL command could be used to quickly apply this to all of the employees stored in the database: UPDATE personal_info SET salary = salary * 1.03 On the other hand, our new employee Bart Simpson has demonstrated performance above and beyond the call of duty. Management wishes to recognize his stellar accomplishments with a $5,000 raise. The WHERE clause could be used to single out Bart for this raise: UPDATE personal_info SET salary = salary + $5000 WHERE employee_id = 12345 </li></ul>
  11. 11. III. Creating the Database (SQL) <ul><li>(continuation) </li></ul><ul><li>The DELETE command with a WHERE clause can be used to remove his record from the personal_info table: DELETE FROM personal_info WHERE employee_id = 12345 </li></ul><ul><li>Joining tables </li></ul><ul><li>Example of 2 tables (personal_info, disciplinary_action) joined together and are joined together by employee ID and whose salaries were greater than 40000 </li></ul><ul><li>SELECT personal_info.first_name, personal_info.last_name, disciplinary_action.comments FROM personal_info, disciplinary_action WHERE personal_info.employee_id = disciplinary_action.employee_id AND personal_info.salary > 40000 </li></ul>
  12. 12. Comments <ul><li>This is a brief introduction in creating a database. There’s a lot of things to take in consideration in creating a database depending on a case by case basis. Numerous variables, data gathering, finding what kind of resources are available to you and so on. Creating a database needs a lot of planning to make it a success the first time you launch it. It’s better to create this slowly and in the process you keep on reevaluating everything that are involve in the project. Numerous revisions and planning are required. This requires patience and diligence in making a good database. </li></ul><ul><li>Some could create this very fast at the expense of numerous debugging later on or changing the formats, changing the queries and the reports. I don’t recommend this. I prefer to do in slow but sure. Repairing something is more tiring and time consuming than creating it the first time around. In creating something, you have full focus, there’s excitement and there’s enthusiasm involved but not in repairing something. </li></ul><ul><li>This is just the start, to know more check the Internet or read books or go to school. Happy creating your database! </li></ul>
  13. 13. Source <ul><li> </li></ul><ul><li>Thank you for watching! </li></ul><ul><li>****The End*** </li></ul>