Database Applications for Managers Spring 2008  BU4040

Home  |  Syllabus  |  Journal  | Project Exam Research  |  Gallery

Journal

Dr. Alireza Ebrahimi

 

Database Applications for Managers Spring 2008  BU4040

Home  |  Syllabus  |  Journal  | Project Exam Research  |  Gallery

Journal

Dr. Alireza Ebrahimi

Journal Wednesday April 21st, 2008

 

1) How does the Google database or Yahoo database work?

 Both are search engines but they have to have a database.  They have to add, remove, and  update their information. 

The captain cannot be late.

----------------------------------------------------------------------------------------------------------------------------

Conclusions

Google is designed to be a scalable search engine. The primary goal is to provide high quality search results over a rapidly growing World Wide Web. Google employs a number of techniques to improve search quality including page rank, anchor text, and proximity information. Furthermore, Google is a complete architecture for gathering web pages, indexing them, and performing search queries over them.

---------------------------------------------------------------------------------------------------

A large-scale web search engine is a complex system and much remains to be done. Our immediate goals are to improve search efficiency and to scale to approximately 100 million web pages. Some simple improvements to efficiency include query caching, smart disk allocation, and subindices. Another area which requires much research is updates. We must have smart algorithms to decide what old web pages should be recrawled and what new ones should be crawled. Work toward this goal has been done in [Cho 98]. One promising area of research is using proxy caches to build search databases, since they are demand driven. We are planning to add simple features supported by commercial search engines like boolean operators, negation, and stemming. However, other features are just starting to be explored such as relevance feedback and clustering (Google currently supports a simple hostname based clustering). We also plan to support user context (like the user's location), and result summarization. We are also working to extend the use of link structure and link text. Simple experiments indicate PageRank can be personalized by increasing the weight of a user's home page or bookmarks. As for link text, we are experimenting with using text surrounding links in addition to the link text itself. A Web search engine is a very rich environment for research ideas. We have far too many to list here so we do not expect this Future Work section to become much shorter in the near future.

---------------------------------------------------------------------------------------------------

Farzad contributed this information from :  http://www.readwriteweb.com/archives/yahoo_pipes_web_database.php

The Web is just a vast database of information. Everyday, we interact with it without thinking about that too much. We simply take our best query tool, usually called Google, and fire away. Yet decades before the web made its way into our lives, a different kind of database revolutionized our lives. The Relational Database qualifies as one of our best computer science inventions. Lesser known to the non-techie crowd, it nowadays quietly stores terabytes of information behind most familiar ecommerce and corporate sites.

 

---------------------------------------------------------------------------------------------

 

Christian contributed this from : From Wikipedia, the free encyclopedia

Googlebot

Jump to: navigation, search

A Googlebot is a search bot used by Google. It collects documents from the web to build a searchable index for the Google search engine.

If a webmaster wishes to restrict the information on their site available to a Googlebot, or another well-behaved spider, they can do so with the appropriate directives in a robots.txt file,[1] or by adding the meta tag <meta name="Googlebot" content="noindex"> to the webpage. [2] Googlebot requests to Web servers are discernible from their user-agent string 'Googlebot'.

Googlebot has two versions, deepbot and freshbot. Deepbot, the deep crawler, tries to follow every link on the web and download as many pages as it can to the Google indexers. It completes this process about once a month. Freshbot crawls the web looking for fresh content. It visits websites that change frequently, according to how frequently they change. Currently Googlebot only follows HREF links and SRC links. [3]

Googlebot discovers pages by harvesting all of the links on every page it finds. It then follows these links to other web pages. New web pages must be linked to from another known page on the web in order to be crawled and indexed.

A problem which webmasters have often noted with the Googlebot is that it takes up an enormous amount of bandwidth. This can cause websites to exceed their bandwidth limit and be taken down temporarily. This is especially troublesome for mirror sites which host many gigabytes of data. Google provides "Webmaster Tools" that allow website owners to throttle the crawl rate. [1]

-----------------------------------------------------------------------------------------------

When you search the keywords "dr ebrahimi" on different engines, why is www.drebrahimi.com on top?

is it the number of hits?

----------------------------------------------------------------------------------------------------

contribution by Steve http://nsgd.gso.uri.edu/searchguide.html#Truncation

Advanced Searching
For those desiring more flexibility or additional search terms, you may
now string 2 or more words in each term box and link them with the search
operator of your choice in the pull-down menu to the right of each term
box. The default (word or phrase) indicates ADJ (adjacent) so no
change is necessary during simpler searches. Search terms must be
separated by a space or a comma. The search operators allowed are:

AND (two or more terms)

OR (two or more terms)

AND NOT (two terms only)

NEAR (two terms only)

-------------------------------------------------------------------------------------------

JAVA DATABASE EQUIVALENT TO THE C++ DATABASE

 

The following Java database program demonstrates how your knowledge of C++ will help you to write Java applications. You will realize that the control structures are the same (while, if/else, for); however, there are differences in java file handling and user input. File handling in java is a little more complicated due to the class nature of the file. Input from the keyboard has to be parsed into the desired format. There are two stages of compiling Java programs: compilation and interpretation. The compilation of the .java file creates a .class bytecode file that can be interpreted in virtually any platform (Virtual Machine). One of the benefits of Java is its portability and its ability to create applets that can be run on browsers. Java does not have pointers and applets cannot directly access files due to security restrictions. To read input or values, StreamTokenizer is used to read either a string (sval) or a number (nval) as instance variables. The Cin class is used for input from the keyboard and once it is compiled, the class can be used in other applications as long as it is in the same directory.

----------------------------------------------------------------------------------------

Demo this java script program to receive extra points


import java.io.*;
public class Database {
private staticfinal int MAX = 100;
private Cin cin =new Cin();
private Stringname[] = new String[MAX];
private doublehourlyrate[] = new double[MAX];
private doublehoursworked[] = new double[MAX];
private doublegrosspay[] = new double[MAX];
private StringsearchName;
private StringfileName;
private int n =0;
public void load()throws IOException{
try{ Reader fi = new BufferedReader(
newInputStreamReader(
new FileInputStream("employee.dat")));
StreamTokenizer fin = new StreamTokenizer(fi);
int tokenType;
tokenType= fin.nextToken();
while((tokenType != StreamTokenizer.TT_EOF)){
name[n] = fin.sval;
fin.nextToken();
hourlyrate[n] = fin.nval;
fin.nextToken();
hoursworked[n] = fin.nval;
grosspay[n] = hoursworked[n] * hourlyrate[n];
tokenType = fin.nextToken();
n++;}//WHILE
}//TRY
catch(IOException ex){ System.out.println(ex); }//CATCH
}//LOAD
public voidinsert(){
System.out.print("Enter the employee name: ");
name[n] =cin.readString();
System.out.print("What is employee hourly rate? ");
hourlyrate[n]= cin.readDouble();
System.out.print("How many hours did theemployee work? ");
hoursworked[n]= cin.readDouble();
grosspay[n] =hoursworked[n] * hourlyrate[n];
n++;}//INSERT
public voiddisplay(){
for ( int i =0; i<n; i++ ){
if(name[i]!=""){
System.out.println( name[i] + " " + grosspay[i] );}//IF
}//FOR
}//DISPLAY


public boolean search(){
System.out.print("Enter the search name: ");
String searchName = cin.readString();
for(int i = 0; i < n; i++){
if ( searchName.equalsIgnoreCase(name[i])){
System.out.println("Found: "+name[i]);
System.out.println("Grosspay: "+grosspay[i]);
return true; }//IF
}//FOR
System.out.println("Name not found");
return true;
}//SEARCH
public boolean modify(){
System.out.print("Enter the search name: ");
String searchName = cin.readString();
for(int i = 0; i < n; i++){
if ( searchName.equalsIgnoreCase(name[i])){
System.out.print("What is employee hourly rate? ");
hourlyrate[i] = cin.readDouble();
System.out.print("How many hours did the employee work?");
hoursworked[i] = cin.readDouble();
grosspay[i] = hoursworked[i] * hourlyrate[i];
return true; }//IF
}//FOR
System.out.println("Name not found");
return false;
}//MODIFY
public boolean remove(){
System.out.print("Enter the search name: ");
String searchName = cin.readString();
for(int i = 0; i < n; i++){
if ( searchName.equalsIgnoreCase(name[i])){
name[i] = "";
return true; }//IF
}//FOR
System.out.println("Name not found");
return false;
}//REMOVE
public void quit() throws IOException{
this.store();
System.out.println("Thank you");
System.exit(0);
}//QUIT
public void store() throws IOException{
try{
FileOutputStream out = new FileOutputStream("employee.dat");
PrintStream ps = new PrintStream(out);
for(int i = 0; i < n; i++){
if ( name[i] != "" )
ps.println( name[i] + "\t" + hourlyrate[i] +
"\t" + hoursworked[i] );
}//FOR
out.close(); }//TRY
catch( IOException ex ){
System.out.println(ex); }//CATCH
}//STORE


public static void main( String args[] ) throws IOException{
Database db = new Database();
Cin read = new Cin();
db.load();
int choice = 0;
do{System.out.println("\t1-Insert");
System.out.println("\t2-Display");
System.out.println("\t3-Search");
System.out.println("\t4-Modify");
System.out.println("\t5-Remove");
System.out.println("\t6-Quit");
choice = read.readInt();
if( choice == 1 ) db.insert();
else if( choice == 2 ) db.display();
else if( choice == 3 ) db.search();
else if( choice == 4 ) db.modify();
else if ( choice == 5 ) db.remove();
else if ( choice == 6 ) db.quit();
else System.out.println("Enter correct number");
} while(true);
}//MAIN
}//DATABASE

-----------------------------------------------------------------------------------------------

 

Journal Monday April 16th, 2008

Subtopic of today:

What is Command Line Argument Management: Argument c(argc), Argument v(argv)

How do you make Select Command from C++ with the Command Line Argument.

Te Final questions: 20pts each.

1- Your task is to encrypt all sensitive data (security, privacy) in your database and get rid of the original data (delete files or fields ). -The key for running the encryption is "the quick brown fox jumps over the lazy dog". program is not case sensitive, deal with special characters and numbers in your own creative way. To test your program decrypt the data to get to original database. The test data input is HELLO and the encrypted output you should get is PTFFB. Hint, you may want to use an other key for numbers and special characters.

"the quick brown fox jumps over the lazy dog"
 abcdefghijklmnopqrstuvwxyz, skip letters that are repeated such as "o", "e"

2- You are to design a database from scratch using any file access and memory access mode (sequential, random, array, object, etc.) Be unique and creative. You may want to use C++ or any programming language you are familiar with. show your data file and queries.

3- you are to design a database using access, DB2, Oracle, etc. Use your own SQL query to access the similar data as in question two.

 

4-How does the program on page 703 work if you can explain thoroughly.  20pts.

5-Why should a manager be acquainted with database and its related issues. what is the cost and benefits? (Pros/Cons) The format will be according to the management article on www.ebrahimi.com

ex. The research part of the essay is to get job description/requirements for manager positions.

ex. from essay format:
Why Managers Should Become Better Acquainted
With Programming Issues, Web Source Code, and
Technology?
Alireza Ebrahimi, State University of New York,
College at Old Westbury, USA
Abstract
There has been a controversial debate over how well managers need to acquainted with the area of information technology, especially about what managers need to know of programming and understanding of web source code. Information is an indispensable key to business success

 

 

 

 

Journal Monday

 March 31st, 2008

Go to page 701 and Type and Run the program.

 


<HTML>

<BODY BGCOLOR=ffdeaa>

<CENTER><BR><B>Employee Database</B></CENTER><BR>

<HR WIDTH=65%>

<CENTER>Please select from the following choices:<BR><BR>

<FORM ACTION="insertrecord.html">

<INPUT TYPE="submit" VALUE="1. Insert a Record "></FORM>

<FORM ACTION="cgi-bin/displayall.cgi">

<INPUT TYPE="submit" VALUE="2. Display all Records "></FORM>

<FORM ACTION="search.html">

<INPUT TYPE="submit" VALUE="3. Search Database "></FORM>

<FORM ACTION="cgi-bin/update.cgi">

<INPUT TYPE="submit" VALUE="4. Update Record "></FORM>

<FORM ACTION="cgi-bin/delete.cgi">

<INPUT TYPE="submit" VALUE="5. Delete a Record "></FORM>

</CENTER></BODY>

</HTML>

--------------------------------------------------------------------------------------
<HTML>
<BODY BOCOLOR=FFDEAA>
<CENTER><BR><B>Employee Database</B></CENTER><BR>
<HR WIDTH=65%>
<CENTER>Please select from the following choices:<BR><BR>
<FORM ACTION=="insertrecord.html">
<INPUT TYPE="submit"VALUE="1. Insert a record "></FORM>
</CENTER></BODY>
</HTML>

 

Journal Wednesday

 March 26th, 2008

Q1- Your task is to encrypt all sensitive data (security, privacy) in your database and get rid of the original data (delete files or fields ). -The key for running the encryption is "the quick brown fox jumps over the lazy dog". program is not case sensitive, deal with special characters and numbers in your own creative way. To test your program decrypt the data to get to original database. The test data input is HELLO and the encrypted output you should get is PTFFB. Hint, you may want to use an other key for numbers and special characters.(40 points)

"the quick brown fox jumps over the lazy dog"
 abcdefghijklmnopqrstuvwxyz, skip letters that are repeated such as "o", "e"

Q2- You are to design a database from scratch using any file access and memory access mode (sequential, random, array, object, etc.) Be unique and creative. You may want to use C++ or any programming language you are familiar with. show your data file and queries.(30 points)

 

Q3- you are to design a database using access, DB2, Oracle, etc. Use your own SQL query to access the similar data as in question two. (30 points)

ENCRYPTION EXAMPLE
Following is a sample PL/SQL program to encrypt data. Segments of the code are numbered and contain
narrative text explaining portions of the code.
DECLARE
input_string VARCHAR2(16) := ’tigertigertigert’;
key_string VARCHAR2(8) := ’scottsco’;
encrypted_string VARCHAR2(2048);
decrypted_string VARCHAR2(2048);
error_in_input_buffer_length EXCEPTION;
PRAGMA EXCEPTION_INIT(error_in_input_buffer_length, -28232);
INPUT_BUFFER_LENGTH_ERR_MSG VARCHAR2(100) :=
’*** DES INPUT BUFFER NOT A MULTIPLE OF 8 BYTES ***’;
1. Test string data encryption and decryption-- The interface
for encrypting raw data is similar.
BEGIN           This is the beginning of the program
dbms_output.put_line(’> ========= BEGIN TEST =========’);
dbms_output.put_line(’> Input String :
’ ||
input_string);
BEGIN
dbms_obfuscation_toolkit. input_string => input_string,
key_string => key_string, encrypted_string =>
encrypted_string );
dbms_output.put_line(’> encrypted string : ’
||
encrypted_string);
dbms_obfuscation_toolkit.DESDecrypt(input_string =>
encrypted_string,
key => raw_key, decrypted_string =>
decrypted_string);
dbms_output.put_line(’> Decrypted output : ’
||
decrypted_string);
dbms_output.put_line(’> ’);
if input_string = here is an "if" statement
decrypted_string THEN
dbms_output.put_line(’> DES Encryption and Decryption
successful’);
END if;
EXCEPTION
WHEN error_in_input_buffer_length THEN
dbms_output.put_line(’> ’ ||
INPUT_BUFFER_LENGTH_ERR_MSG);
END;
 

Each row (tuple) from the table is interpreted as follows: an employee has a number, a name,

a job title and a salary. Furthermore, for each employee the number of his/her manager, the

date he/she was hired, and the number of the department where he/she is working are stored.

insert into <table> [(<column i, . . . , column j>)] <query>

create table OLDEMP (

ENO number(4) not null,

HDATE date);

We now can use the table EMP to insert tuples into this new relation:

insert into OLDEMP (ENO, HDATE)

select EMPNO, HIREDATE from EMP

where HIREDATE < ’31-DEC-60’;

 

Journal Monday

 March 24, 2008

Q1- Your task is to encrypt all sensitive data (security, privacy) in your database and get rid of the original data (delete files or fields ). -The key for running the encryption is "the quick brown fox jumps over the lazy dog". program is not case sensitive, deal with special characters and numbers in your own creative way. To test your program decrypt the data to get to original database. The test data input is HELLO and the encrypted output you should get is PTFFB. Hint, you may want to use an other key for numbers and special characters.(40 points)

"the quick brown fox jumps over the lazy dog"
 abcdefghijklmnopqrstuvwxyz, skip letters that are repeated such as "o", "e"

Q2- You are to design a database from scratch using any file access and memory access mode (sequential, random, array, object, etc.) Be unique and creative. You may want to use C++ or any programming language you are familiar with. show your data file and queries.(30 points)

 

Q3- you are to design a database using access, DB2, Oracle, etc. Use your own SQL query to access the similar data as in question two. (30 points)

 

Journal Wednesday February 27, 2008

THIS WORK BELOW IS DUE ON MONDAY FIRST 1/2 OF THE CLASS

 

- We will retake the test to the online and we will log on to:   https://oldwestbury.sln.suny.edu/frames.aspx and log in.

 

1 -On page 297 run the program as is FIRST

2 -Change this so it becomes a Membership Database such as username and password.

3 - Encrypt the password before saving it to the file.

Today we will show you a program in Dev C++ from page 297.

Each student should reproduce the program on their own workstation.   The program above does not have all of the functions declared and will not compile.

Below is version 2 of the program with all of the functions coded.

#include<iostream>
using namespace std;
char rfappend(){
cout<<"Append Under Construction "<<endl;
return 0;
}
char rfdisplay(){
cout<<"Append Under Construction "<<endl;
return 0;
}
char rfsearch(){
cout<<"Append Under Construction "<<endl;
return 0;
}
char rfmodify(){
cout<<"Append Under Construction "<<endl;
return 0;
}
char rfdelete(){
cout<<"Append Under Construction "<<endl;
return 0;
}
main(){char option;
cout<<"SELECT ONE OF THE FOLLOWING "<<endl;
cout<<"\t TYPE 1 TO INSERT "<<endl;
cout<<"\t TYPE 2 TO DISPLAY "<<endl;
cout<<"\t TYPE 3 TO SEARCH "<<endl;
cout<<"\t TYPE 4 TO MODIFY"<<endl;
cout<<"\t TYPE 5 TO DELETE "<<endl;
cout<<"\t TYPE # TO QUIT "<<endl<<endl;
cin>>option;
switch(option){
case '1': rfappend();
break;
case '2': rfdisplay();
break;
case '3': rfsearch();
break;
case '4': rfmodify();
break;
case '5': rfdelete();
break;
case '#': cout<<"BYE "<<endl;
exit(1);
break;}//SWITCH
system ("Pause");
return 0;
}
 

Testing our program...

Testing is VERY important.   Many databases and programs are not tested enough.

Make your messages friendly and clear.

#include<iostream>
using namespace std;
char rfappend(){
cout<<"Append Under Construction "<<endl;
return 0;
}
char rfdisplay(){
cout<<"Display Under Construction "<<endl;
return 0;
}
char rfsearch(){
cout<<"Search Under Construction "<<endl;
return 0;
}
char rfmodify(){
cout<<"Modify Under Construction "<<endl;
return 0;
}
char rfdelete(){
cout<<"Delete Under Construction "<<endl;
return 0;
}
main(){char option;
while(1){
cout<<"SELECT ONE OF THE FOLLOWING "<<endl;
cout<<"\t TYPE 1 TO INSERT "<<endl;
cout<<"\t TYPE 2 TO DISPLAY "<<endl;
cout<<"\t TYPE 3 TO SEARCH "<<endl;
cout<<"\t TYPE 4 TO MODIFY"<<endl;
cout<<"\t TYPE 5 TO DELETE "<<endl;
cout<<"\t TYPE # TO QUIT "<<endl<<endl;
cin>>option;
switch(option){
case '1': rfappend();
break;
case '2': rfdisplay();
break;
case '3': rfsearch();
break;
case '4': rfmodify();
break;
case '5': rfdelete();
break;
case '#': cout<<"BYE "<<endl;
exit(1);
break ;
default: cout<<"Enter 1 to 5"<<endl;
}//SWITCH
}//WHILE
system ("Pause");
return 0;
}

The code with the append function

#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
char rfappend(char personname[], char phone[]){
ofstream fout("directory.in",ios::app);
cout<<"ENTER PERSON NAME ";
cin>>personname;
cout<<"ENTER THE PHONE NUMBER ";
cin>>phone;
fout<<personname<<setw(20)<<phone<<endl;
fout.close();

return 0;
}
char rfdisplay(char personname[], char phone[]){
ifstream fin ("directory.in");
while (fin>>personname>>phone){
cout<<"PERSON NAME IS "<<personname<<endl<<endl;
cout<<"PHONE IS "<<phone<<endl<<endl; }//WHILE
fin.close();
return 0; }
char rfsearch(){
cout<<"Search Under Construction "<<endl;
return 0;
}
char rfmodify(){
cout<<"Modify Under Construction "<<endl;
return 0;
}
char rfdelete(){
cout<<"Delete Under Construction "<<endl;
return 0;
}
main()
{char personname[100], phone[10],option;
while(1){
cout<<"SELECT ONE OF THE FOLLOWING "<<endl;
cout<<"\t TYPE 1 TO INSERT "<<endl;
cout<<"\t TYPE 2 TO DISPLAY "<<endl;
cout<<"\t TYPE 3 TO SEARCH "<<endl;
cout<<"\t TYPE 4 TO MODIFY"<<endl;
cout<<"\t TYPE 5 TO DELETE "<<endl;
cout<<"\t TYPE # TO QUIT "<<endl<<endl;
cin>>option;
switch(option){
case '1': rfappend(personname,phone);
break;
case '2': rfdisplay(personname,phone);
break;
case '3': rfsearch();
break;
case '4': rfmodify();
break;
case '5': rfdelete();
break;
case '#': cout<<"BYE "<<endl;
exit(1);
break ;
default: cout<<"Enter 1 to 5"<<endl;
}//SWITCH
}//WHILE
system ("Pause");
return 0;
}
 

This program will send out the input to a file called directory.in.

Binary vs. Text files

Binary files are used to store executable code, Text Files are used to store raw text from the system.
 

For Last year notes : Class notes

Journal Monday February 25, 2008

After you finish answering the questions Email to: ebrahimidr@gmail.com  

 

Name______________________________________

 

T / F 1) A database has operations such as storing, displaying, and searching for records.

 

T / F 2) A file should be closed before it is opened again for another operation mode.

 

T / F 3) A file can be accessed sequentially as well as randomly.

 

T / F 4) The most efficient way to delete from a file is to copy the entire file, excluding deleted data.

 

T / F 5) Random access becomes faster if each record has a fixed length with a unique key.

 

T / F 6) Binary files store the binary value of a number instead of its ASCII value.

 

T / F 7) Modification is more difficult in arrays rather than in a sequential file.

 

T / F 8) It is better to store large amounts of data into an array rather than into a file.

 

T / F 9) Information in an array will be lost after the program terminates.

 

T / F 10) In sequential files, modification requires duplication of the existing file.

 

T / F 11) A data file is a file in which data is stored and from which data is retrieved.

 

T / F 12) In random access there is no need for duplication of the file when deleting a record.

 

T / F 13) When deleting a record from an array, the physical storage will be deleted.

 

T / F 14) It is necessary to shuffle an array upon deletion to make the insertion faster.

 

T / F 15) If the array is not shuffled after deletion, it is necessary to indicate that the record was deleted.

 

T / F 16) A Database is a collection of unrelated data.

 

T / F 17) One person having many credit cards is an example of a many-to-many relationship.

 

T / F 18) The most important function in a database is delete.

 

T / F 19) A database can have at most one table.

 

T / F 20) The importance of normalization of a database is to create more memory for redundancy of data.

 =====================================================================================

T / F 21) Simple file encryption can be done by changing ASCII values or by using an associate array.

 

T / F 22) Overtime pay computation is a function of select command and SQL reports are an example of database manipulation.

 

T / F 23) A database report is used by managers to enter new records to a database.

 

T / F 24) Add (append) , Delete (purge), Modify (update), and Search are all functions of operating systems.

T / F 25) The interaction between you and your computer is also known as an interface.

 

T / F 26) Three categories of data models are conceptual, physical, and implementation.

 

T / F 27) A database schema includes descriptions of the database structure and the constraints that should hold on the database.

 

T / F 28) C++ is an example of a DBMS language.
 
T / F 29) A primary key is necessary to uniquely identify a record in a table; two records may have the same value in the field designated as primary key.
 
T / F 30) Creating relationships between tables increases data redundancy and makes a database less efficient.
 
T / F 31)  When input data becomes large, it is necessary to work with a data file rather than typing it.
 
 
T / F 33) Unicode consists of 32 bits.
 
T / F 34) A database consists of infinite fields.
 
T / F 35) A load function will read all records from a file into an array and should be called at the start of a program.

 

T / F 36) ifstream fin(“data.txt”,ios::in); if(!fin) cout<<”NO FILE”;  will test the file’s existence.

 

T / F 37) A file can be opened for both input and output such as fstream fout(“data.dat”, ios::in|ios::out);

 

T / F 38) “del” and “rename” in C++ which are to delete and rename a file, are equivalent to “rm” and “mv” which are in Linux or Unix.

 

T / F 39) A binary search is fastest for searching a large unsorted data file.
 

T / F 40) Database validation of user input is necessary for fields such as phone number and social security to ensure data integrity.

 

T / F 41) Sequential search is preferred over hashing because of the speed.

 

T / F 42) The C++, system( ) function enables the programmer to use operating system commands.

 

T / F 43) In a random access file, seekg( ) is used for putting data and seekp( ) is used for getting data.

 

T / F 44) Most of today’s databases interact with the user and then access the data file to search and to perform the necessary operations.

T / F 45) A table in a relational database is a predefined format of rows and columns that define an entity.

T / F 46) Examples of databases are WindowsNT, UNIX, DB2, MYSQL, and Solaris.
 

T / F 47) You can create CGI web databases using the following programming languages: C/C++ and Perl.

 

T / F 48) The three example databases are Access, SQL, and Oracle.

 

T / F 49) In a database, a table contains records, records contain fields, fields contain characters, a character contains a byte or two.

 

 

T / F 50) Encryption is essential when working with databases to keep information unaccessible.

 =====================================================================================

T / F 51) A bite has a single binary value, either 0 or 1.
 

T / F 52) FUZZY logic has more than two states.


T / F 53)
By using a linked list the deleted record will be physically deleted.

 

T / F 54)A relational database is a collection of organized data that are related between its

various data members.


T / F 55) A byte is the smallest addressable unit of data in a computer.


T / F 56) A database can be made in any language such as C++, Java, Visual Basic, or JavaScript.


T / F 57) The interaction between you and your computer is also known as an interface.


T / F 58) C++ is the foundation for the most popular database application on the Internet.


T / F 59) The three example databases are Adobe, PowerPoint, and Microsoft Word


T / F 60) An example of Data Manipulation\Reporting in a Payroll\Bank Database is an overtime pay report.


T / F 61) There have been as many as 9,000 deaths as a result of medical database errors each year.


T / F 62) Ingres is a database under windows operating systems.



T / F 63) Primary key is used in relational databases to uniquely identify records.


T / F 64) For a database security is more important than access.


T / F 65) Database Normalization is used to minimize duplication of information.


T / F 66) The main functions of the database are: create, read, update, duplicate, and delete.


T / F 67) A key feature of the computer is the ability to store information, and to retrieve it at a later time.

T/F 68) The important commands of SQL are select, update, and purge.

T/F 69) The Assignment for this class is to design a Web interface.

T/F 70) To create a database interface you must use Oracle.


T/F 71) In order to design a database with access it must be specified the length and type of each field.

T/F 72) In Unicode the value of 'A' is 65 and 'a' is 97.

T/F 73) It is possible to create a database on Web by using CGI.

T/F 74) The most important function of a database is the search function.

T/F 75) It is possible to retrieve deleted records from a database.

 

Journal Wednesday February 20, 2008

 

Next class we will have our first quiz. all questions by us. please Email to ebrahimidr@gmail.com  

Please have questions from all areas covered, Test will be on Monday 25th 2008 100 T/F Questions.

Most questions in this example are from chap. 9 That are important for a strong foundation of database

1- First copy and paste the questions from the website to a blank page.

2- Answer all questions and Email them to ebrahimidr@gmail.com  

3- Copy this to your wcm Exam Webpage.

Today we will discuss backing up your database.

Page 291-292 functions:

WHAT IS A DATABASE (dbase)

Manipulating data (information) plays an important role in any organization today. In order to manipulate the data, information has to be stored, retrieved, modified or deleted. At any moment new data can be added to a file, or existing information can be retrieved, modified or even deleted. Instead of one file there might be several files needed to store information as well as to interact with other files (file processing). The notion of data manipulation where data may be stored, retrieved, modified or even deleted is called a database.  In addition, there are times when it is necessary to generate reports based on a certain request or computations from the database.

 

 

A JOURNEY FROM BIT TO DATABASE

 

Computer information is represented in binary form using a bit.  Each bit contains a value which is either zero or one. Eight bits represent a byte. Depending on the system one or two bytes represent a character. Several characters form a field or a string. One or more fields make up a record. Multiple records build a stream or a file. Finally several files create a database. However this naming convention may vary slightly, a string may represent the whole file or a database may contain only a single file.

 

 

BUILDING A SIMPLE DATABASE: Create, Display and Search

 

The following program illustrates how easily you can build a simple database by putting a few functions together. For the sake of simplicity, the database program will add, display and search the data immediately, with data modification and deletion performed later. In writing this program, the concern is simplicity rather than efficiency (speed of program or saving space). The three functions for this database are myappend() to add a record to the end of data file, mydisplay() to display entire records, and mysearch() to search  for a particular record.

 

 

MODE OF OPENING A FILE

 

A file can be opened according to the following ways (modes):

A file can be opened as an input file so that data can be retrieved.

ifstream fin (“data.in”,ios::in);

 

      

 The default file mode for ifstream is ios::in

ifstream fin (“data.in”); //input stream

 

      

A file can be opened so that data can be written or output to it.

ofstream fout (“data.out”,ios::out);

 

     

  The default file mode for ofstream is ios::ou

ofstream fout (“data.out”);

 

       

 

In addition a file can be for output by adding (appending) data to the end of the existing file.

ofstream fout (“data.out”,ios::app);

          

A file can be for both input and output ios::in | ios::out

 

fstream fout (“data.dat”, ios::in|ios::out);

 

Ruan  contribution for today program from page 292.

 

#include<fstream>

#include<string.h>

#include<iostream>

#include<iomanip>

#include<stdlib.h>

using namespace std;

int myappend(char personname[],char phone[]){

ofstream fout("directory.txt",ios::app);

cout<<"ENTER PERSON NAME";

cin>>personname;

cout<<"Enter THE PHONE";

cin>>phone;

fout<<personname<<setw(20)<<phone<<endl;

return 0; }// MyAppend

int mysearch(char personname[],char phone[]){

char searchname[20];

ifstream fin("directory.txt",ios::in);

cout<<"ENTER THe Search Name";

cin>>searchname;

while(fin>>personname>>phone){

if(strcmp(searchname,personname)==0){

cout<<"THE PHONE IS" <<phone<<endl<<endl;

return 1; } //if

}// while

cout<<"NAME NOT FOUND" <<endl;

return 0; } //MYSearch

int mydisplay(char personname[],char phone[]){

ifstream fin("directory.txt");

while(fin>>personname>>phone){

cout<<"PERSON NAME IS" << personname<<endl;

cout<<"PHONE IS " <<phone<<endl; }//while

return 0; } // My Display

main(){

char option;

char personname[20],phone[20];

cout<<"Select One Of The Following" << endl;

while(1) { cout<<"TYPE 1 TO INSERT" <<endl;

cout<<"TYPE 2 TO Display" <<endl;

cout<<"TYPE 3 TO Search" <<endl;

cout<<"TYPE # TO Quit" <<endl;

cin>>option;

if(option =='1')myappend(personname,phone);

else if (option=='2') mydisplay(personname,phone);

else if (option=='3') mysearch(personname,phone);

else if (option=='#') {cout<<"BYE"<<endl;exit(1);} } //while

return 0;

}//Main

 

 

 YEAR 2007 NOTES Class notes

 

 

Journal Wednesday February 13, 2008

Please have questions from all areas covered, Test will be on Monday 25th 2008 100 T/F Questions.

 

Most questions in this example are from chap. 9 That are important for a strong foundation of database

 

This is an example of last years test please try to use all topics covered in the semester.

 

 

BU 5010 Database Applications for Managers                                                            

Quiz 1 True / False                                                                                                        Spring 2007

 

Name______________________________________

 

T / F 1) A database has operations such as storing, displaying, and searching for records.

 

T / F 2) A file should be closed before it is opened again in another operation mode.

 

T / F 3) A file can be accessed sequentially as well as randomly.

 

T / F 4) The most efficient way to delete from a file is to copy the entire file, excluding deleted data.

 

T / F 5) Random access becomes faster if each record has a fixed length with a unique key.

 

T / F 6) Binary files store the binary value of a number instead of its ASCII value.

 

T / F 7) Modification is more difficult in arrays rather than in a sequential file.

 

T / F 8) It is better to store large amounts of data into an array rather than into a file.

 

T / F 9) Information in an array will be lost after the program terminates.

 

T / F 10) In sequential files, modification requires duplication of the existing file.

 

T / F 11) A data file is a file in which data is stored and from which data is retrieved.

 

T / F 12) In random access file there is no need for duplication of the file when deleting a record.

 

Answer: True there is no need for duplication.

 

- Give me one example of deleting a file of database and why?

 Answer: A student must be deleted from active students after they graduated

 

- If you have a  cassette tape containing two song and you need to delete song one how will you do it?

Answer: copy the song one into a blank cassette tape, if you deleted  from the tape you would have a blank gap for the length of the song.

 

What is a Random Access?

Answer: A CD is a random access

 

 

T / F 13) When deleting a record from an array, the physical storage will be deleted.

 

T / F 14) It is necessary to shuffle an array upon deletion to make the insertion faster.

 

T / F 15) If the array is not shuffled after deletion, it is necessary to indicate that the record was deleted.

 

T / F 16) A Database is a collection of related data.

 

T / F 17) One person having many credit cards is an example of a many-to-many relationship.

 

T / F 18) The most important function in a database is delete.

 

T / F 19) A database can have at most one table.

 

Answer: False - At least one table

 

T / F 20) The importance of normalization of a database is to eliminate waste of memory and redundancy of data.

Database normalization, sometimes referred to as canonical synthesis, is a technique for designing relational database tables to minimize duplication of information and, in so doing, to safeguard the database against certain types of logical or structural problems, namely data anomalies. For example, when multiple instances of a given piece of information occur in a table, the possibility exists that these instances will not be kept consistent when the data within the table is updated, leading to a loss of data integrity. A table that is sufficiently normalized is less vulnerable to problems of this kind, because its structure reflects the basic assumptions for when multiple instances of the same information should be represented by a single instance only.

Higher degrees of normalization typically involve more tables and create the need for a larger number of joins, which can reduce performance. Accordingly, more highly normalized tables are typically used in database applications involving many isolated transactions (e.g. an Automated teller machine), while less normalized tables tend to be used in database applications that do not need to map complex relationships between data entities and data attributes (e.g. a reporting application, or a full-text search application).

Database theory describes a table's degree of normalization in terms of normal forms of successively higher degrees of strictness. A table in third normal form (3NF), for example, is consequently in second normal form (2NF) as well; but the reverse is not always the case

 

 

T / F 21) Simple file encryption can be done by changing ASCII values or by using an associate array.

 

Answer: True The sensitive material should always be encrypted. This is Part of Internet security.

 

ASCII American Standard Code for Information Interchange

T / F 22) A data file is an executable file that performs a database function.

 

T / F 23) A database report is used by managers to enter new records to a database.

 

T / F 24) A Database Designer’s responsibility is to define the content, the structure, the constraints, and functions or transactions against the database.

 

T / F 25) A set of concepts to describe the structure and the constraints of a database is called a data object.

 

T / F 26) Three categories of data models are conceptual, physical, and implementation.

 

T / F 27) A database schema includes descriptions of the database structure and the constraints that should hold on the database.

 

T / F 28) C++ is an example of a DBMS language.
 
T / F 29) A primary key is necessary to uniquely identify a record in a table; two records may have the same value in the field designated as primary key.
 
T / F 30) Creating relationships between tables increases data redundancy and makes a database less efficient.
 
T / F 31)  The proper C++ code to open a text file is:
ifstream studentFile("students.txt", ios::in);
 
T / F 32) In C++, the syntax code if (!fin) can be used instead of if (fin==NULL). 
 
T / F 33) Unicode consists of 8-16 bits.
 
T / F 34) A database consists of many fields.
 
T / F 35) A load function will read all records from a file into an array and should be called at the start of a program.

 

T / F 36) ifstream fin(“data.txt”,ios::in); if(!fin) cout<<”NO FILE”;  will test the file’s existence.

 

T / F 37) A file can be opened for both input and output such as fstream fout(“data.dat”, ios::in|ios::out);

 

T / F 38) ofstream outfile(“data.txt”, ios::noreplace);  prevents an existing file from being overwritten.

 

T / F 39) A binary search is fastest for searching a large unsorted data file.
 

T / F 40) Database validation of user input is necessary for fields such as phone number and social security to ensure data integrity.

 

T / F 41) Sequential search is preferred over hashing because of the speed.

 

T / F 42) The C++ system( ) function enables the programmer to use operating system commands.

 

 

Answer:

 

 This are some known operating systems Windows , Solaris Sparc, Solaris Intel , QNX , OS/2 , MacOS , Linux Sparc, Linux PowerPC, Linux i386, FreeBSD i386 , BeOS
 

T / F 43) In a random access file, seekg( ) is used for putting data and seekp( ) is used for getting data.

 

T / F 44) Access will not allow you to create a one to many relationship due to security.

 

T / F 45) Semantic databases are based on the grammar of the expression.

 

T / F 46) ifstream fin(“data.txt”, ios::in); associates a file for output access.

 

T / F 47) You can create CGI web databases using the following programming languages: C/C++ and Perl.

 

T / F 48) The three example databases are Access, SQL, and Oracle.

 

T / F 49) In order for a C++ database program to read from a textfile it is not necessary to use; #include<fstream>.

 

 

T / F 50) In a C++ database program, it is not required that you include the name of the textfile, in order for the program to locate it and access the data.

 

T / F 51) A software package/ system to facilitate the creation and maintenance of a computerized database is known as DBA.


T / F 52)A DBMS doesn’t involve in any sort of program security or do any active processing.

T / F 53) A set of concepts to describe the structure of a database, and certain constraints that the database should obey is known as Data Model Operations.

T / F 54) An entity is an object that is distinguishable from other objects by a specific set of attributes.

T / F 55)
Using write( ) function from <fstream>, one can write an entire structure (record) to a file.


T / F 56)
By using a linked list the deleted record will be physically deleted.

 

T / F 57) Conceptual data models describe details of how data is stored in the computer.

 

T / F 58) The Entity Relationship Model consists of entities with no possible relation to each other.

 

T / F 59) In the Object Oriented Model, objects consist of data operations on the data.

 

T / F 60) The physical implementation of your database files at the lowest level is specified at the conceptual level.

 

 

 

 

 

Journal Monday February 11, 2008

Please have questions from all areas covered, Test will be on Monday Feb 25th 2008 100 T/F Questions.

 

For Feb. 11 we will have an online class.  please submit 10 true/ false questions from the material we have covered so far. These questions may be part of your Journal, assignments, gallery or the research. Your questions should not be trivial and tricky. Please find a way to be unique.

Please read and test the following Programs for Feb 11 2008.

 

 

Design and Create a Menu for your Database

    Examples:

 

Employee Database:

 

void main(){

                load();

                char choice='0';

                while (choice!='e'&&choice!='E'){

                cout<<endl<<"Payroll Database"<<endl;

   cout<<"1. Insert Employee Record and Compute Net Pay"<<endl;

                cout<<"2. Display All Records"<<endl;

                cout<<"3. Search Database"<<endl;

                cout<<"4. Update Record"<<endl;

                cout<<"5. Delete Record"<<endl;

                cout<<"6. Generate Report"<<endl;

                cout<<"7. Delete Database File"<<endl;

                cout<<"8. Back-up Database File"<<endl;

                cout<<endl<<" Type e to exit"<<endl<<endl;

                cout<<"Enter the number of your choice:";

                cin>>choice;         cout<<endl;

                switch (choice){

                 case '1': insert(); break;

                 case '2': display(); break;

                 case '3': char s[100]; int index;

                     cout<<"Enter the last name of the person you want: ";

                                cin>>s;

                                index=search(s);

                                if(index!=-1) {

     cout<<"Name: "<<e[index].fname<<" "<<e[index].lname<<endl;

                   cout<<"Hourly Rate: "<<e[index].hourlyrate<<endl;

               cout<<"Hrs Worked: "<<e[index].hoursworked<<endl;

              cout<<"Net Pay: "<<e[index].netpay<<endl<<endl;}//IF

                 else cout<<"EMPLOYEE NOT FOUND"<<endl;

                                break;

                 case '4': update(); break;

                 case '5': deleterec(); break;

                 case '6': report(); break;

                 case '7': deletefile(); break;

                 case '8': backupfile(); break;

                 case 'e': store(); break; //EXIT

                 default: cout<<"Invalid Choice"<<endl; break; }//SWITCH

}//WHILE

}//MAIN

 

Java example:

 

       public static void main( String args[] ) throws IOException{

        Database db = new Database();

        Cin read = new Cin();

        db.load();

        int choice = 0;

        do{System.out.println("\t1-Insert");

           System.out.println("\t2-Display");

           System.out.println("\t3-Search");

           System.out.println("\t4-Modify");

           System.out.println("\t5-Remove");

           System.out.println("\t6-Quit");

           choice = read.readInt();

           if( choice == 1 ) db.insert();

           else if( choice == 2 ) db.display();

           else if( choice == 3 ) db.search();

           else if( choice == 4 ) db.modify();

           else if ( choice == 5 ) db.remove();

           else if ( choice == 6 ) db.quit();

           else System.out.println("Enter correct number");

        } while(true);

    }//MAIN

 

Wednesday February 6, 2008

During the last class we spoke about implementing a user interface, accessing database files and database management software.

What were the database management software we discussed?

Oracle, Informix, Microsoft SQL, Ingres,  Postgres, Access, DB2 etc.

What is a relational database?

A relational database is a collection of organized data in which there are relationships between the various data members.  For instance two tables within a database that relate to each other.  In the example of an academic information systems database you could have one table that holds all location information (street address, town, phone number) that could relate to both the student table and the staff/professor table.

Contributed by Brendan from Wikipedia- A relational database is a database that conforms to the relational model, and refers to a database's data and schema (the database's structure of how that data is arranged).

 

  Today we are going to be going over student demonstrations .

What are the four database functions?  Add (append) , Delete (purge), Modify (update), Search

Bill's Database Demo

The first thing you need to do when organizing/designing your database application is to sit down and write out what your requirements are.

Terms that are important for database design are

Relational Database- A collection of data items organized and a set of formally described tables from which data can be accessed or reassembled in many different ways without having to reorganize the database tables. (http://searchsqlserver.techtarget.com/sDefinition/0,,sid87_gci212885,00.html)

Tuple-  Is a finite sequence (also known as an "ordered list") of objects, each of a specified type (see record)

Record- row—also called a record or tuple—represents a single, implicitly structured data item in a table

table  A collection of data in defined rows and columns.  We have included an example of a table below from page 289 in the textbook. 

Why should we have more than one table?  

 

bit- A bit is a binary digit, taking a value of either 0 or 1. For example, the number 10010111 is 8 bits long,
 

byte In computer science a byte (pronounced "bite", IPA: /baɪt/) is a unit of measurement of information storage, most often consisting of eight bits.
 

primary key- In relational database design, a unique key or primary key is a candidate key to uniquely identify each row in a table.

 

 In an database application you need to have two layers.  The application design layer and the user layer..

We also looked at XML eXtensible Markup Language formats for relational databases

Here is a sample.

In the XML you makeup your own data tags to delimit the fields.  In this example we have the table AUTHORS.   Each record is surrounded by the the tag <author> and ends with the tag </author> indicating the end of the record.   Each column in the record is also surrounded by data tags so the field name is surrounded by <name> to indicate the start of the field and the tag </name> to indicate the end of the field.

<!doctype mydata "http://www.w3.org/mydata">
<mydata>

<authors>
<author>
<name>Robert Roberts</name>
<address>10 Tenth St, Decapolis</address>
<editor>Ella Ellis</editor>
<ms type="blob">ftp://docs/rr-10</ms>
<born>1960/05/26</born>
</author>

<author>
<name>Tom Thomas</name>
<address>2 Second Av, Duo-Duo</address>
<editor>Ella Ellis</editor>
<ms type="blob">ftp://docs/tt-2</ms>
</author>

<author>
<name>Mark Marks</name>
<address>1 Premier, Maintown</address>
<editor>Ella Ellis</editor>
<ms type="blob">ftp://docs/mm-1</ms>
</author>
</authors>

<editors>
<editor>
<name>Ella Ellis</name>
<telephone>7356</telephone>
</editor>
</editors>

</mydata>

Journal Wednesday January 23, 2008

 

Welcome aboard to Database Application for Managers

1) What is a database?

2) What is database applications?

 

3) What is database applications for managers?

4) Database assignment: Design a DB interface, be unique: from simplest ATM, or payroll examples, to a complex DB interface such as school registration system.

    a) Using any programming language such as C++, Java, Visual Basic, or    JavaScript

    b) HTML form

    c) Existing databases

 

 

 

Contribution by Cristian Castro (student)

What is a Database?

Databases are designed to offer an organized mechanism for storing, managing and retrieving information. They do so through the use of tables. If you’re familiar with spreadsheets like Microsoft Excel, you’re probably already accustomed to storing data in tabular form. It’s not much of a stretch to make the leap from spreadsheets to databases. Let’s take a look. Database Tables. Just like Excel tables, database tables consist of columns and rows. Each column contains a different type of attribute and each row corresponds to a single record. For example, imagine that we were building a database table that contained names and telephone numbers. We’d probably set up columns named “FirstName”, “LastName” and “TelephoneNumber.” Then we’d simply start adding rows underneath those columns that contained the data we’re planning to store.
If we were building a table of contact information for our business that has 50 employees, we’d wind up with a table that contains 50 rows.

About.com

 

What is a database application?

A database application provides a way to perform regular tasks much more efficiently by using a database and programming to control and display information.  An example would be a contact management system for your company, or an online shopping cart.  We develop our web applications using php/mysql. A type of application that helps you keep track of lists of information.  Database applications make it easy to recall and update information and to create reports of subsets of information.

http://www.johnboyproductions.com/database-applications

 

Contribution by Farzad Anshir (Student)

Database: An organized collection of records presented in a standardized format searched by computers. WebPals, I.D. Weeks Library's Online Catalog, is a database. The periodical indexes available through the library are also databases.

http://www.usd.edu/library/instruction/glossary.shtml 

 

Journal Wednesday January 28, 2008

 Review of last class

Welcome aboard to Database Application for Managers.

How many ways can you abbreviate database?  DB, Dbase..

For next class, answer the following questions.  You can use the textbook or any online website.

1) What is a database?

2) What is database applications?

 3) What is database applications for managers?

4) Database assignment: Design a DB interface for a manager of a sample company, be unique: from simplest ATM, or payroll examples, to a complex DB interface such as school registration system.

    a) Using any programming language such as C++, Java, Visual Basic, or    JavaScript

    b) HTML form

    c) Existing databases

Today's Work:  1/28/2007

1) What is a database?  A base for data.   What does this mean?  This is the location for data to be stored and retrieved.  For a database to be effective, it must be retrieved in a method that is efficient, accurate and useful. 

Another characteristic of a database is that data can be manipulated (this is usually done through the application or a database language like Transact SQL). 

Example of Data Manipulation\Reporting in a Payroll\Bank Database

    a)  Overtime pay report

    b) Reports based on transaction amounts for a bank (Over $10K)

    c) Computations- the calculation of average payroll across departments or the sum of total payroll liabilities.

Efficient databases and data manipulation are often used in making business decisions.

Who uses databases?

  a)  The entire company!!

   b)  Registrar and other college offices use databases to manage financial resources, facilities, staff allocations and assignments and student records/registration information.

Think of all the variables that could occur in just the student records database- In OW we have:

Full time students, part time students and non-matriculated students.  All of these data types must be managed and stored through a database and the application. 

2) What is a database application?  An interface and/or executable that allows access to the database in a method that is user friendly and efficient.

 3) What is database applications for managers?  A database application that allows decisions to be made about operations within a company.  It usually includes higher level functions over a standard user level application.

4) Database assignment: Design a DB interface for a manager of a sample company. Be unique: from simplest ATM, or payroll examples, to a complex DB interface such as school registration system or government database.

    What do we mean by an interface?  Take a look at chapter 2, there is an ATM machine example.

the program is on page# 31there is one written in C, and one written in C++:

INTERFACE = Between you and machine

( could be text and graphic) the most important is the content. usually graphics make it more friendly.

Question? can the information be trusted.

Use the example on page 31....

Part of the application should identify the name of the company/application.

With an ATM program on page 31 we have the following display:

Purpose:  cout<<< "Ebrahimi Bank of New York" <<endl;

  Functions: 

                    cout<< "\t 1. Deposit \t\t 2.Withdraw"<<endl;

                    cout<< "\t 3. Transfer \t\t 4.Loan"<<endl;

                    cout<< "\t 5. Balance \t\t  6.Help"<<endl;

Why do we focus on C++?   C++ is the foundation for the most popular database application on the Internet.

 

    Please review the syllabus. Click here to go to the Syllabus

Any contributions to class discussion will get you at least 2 points.

Look over the syllabus and bring any related materials to class for extra points toward classroom participation.

to do the WCM first make six pages (view example)

*      1-open six pages

*      1 

*      2-copy this and fix the hyperlink to fit your page, then paste to all the pages.

3-  3-save as and name them home, syllabus, journal, project, exam, research, gallery

 

Journal Wednesday January 30, 2008

 Chapter 9th will be review in today's class:

The fastest search engine, not jet patented is on the book, please review it starting on page 284 to page 291 on volume one.

1. the fastest search = fastest database

FILE HANDLING:  A DATABASE

from chapter 9th,

    A key feature of the computer is the ability to store information, and to retrieve it at a later time. The information (data) has to be saved somewhere, which is called a file, and has to be under a name, which is called a filename. A program constantly interacts with the files to store, retrieve, modify or delete the data. Traditionally, a file that is used to store or retrieve data is called a data file or an input file. A data file may contain personal information such as the names of employees, their telephone numbers and salaries.

    You may work interactively with a program and enter the data each time. However, when the input data becomes large, it is necessary to work with a data file rather than typing the data over and over each time. One example of a data file would be supermarket pricing, where a huge amount of data is manipulated.  In today’s web engine, hundreds of files may have to be processed in order to complete a search. The advancement of the Internet has proportionally increased the number of files and their size.  For any organization, data processing and data manipulation are essential operations.  A database runs the day-to-day operations by adding new records, searching for particular record(s), modifying the existing records and generating reports. Due to the real-time demand of data, the efficiency of databases is subject to review and, as a result, a tremendous effort has been spent to secure their reliability

1) Information and data are two different things: according to Dr. Ebrahimi they are the same.

2) An example of a report is running the particular information, such as # of credits, salaries, etc.

 

Information: is data that has been process so it has meaning and value   
Data: refers to raw facts names, numbers, sounds. (contribution by Farzad)

The IBM Selective Sequence Electronic Calculator

IBM's Selective Sequence Electronic Calculator (SSEC), built at IBM's Endicott facility under the direction of Columbia Professor Wallace Eckert and his Watson Scientific Computing Laboratory staff in 1946-47, shown here after it was moved to the new IBM Headquarters Building at 590 Madison Avenue in Manhattan [4], where it occupied the periphery of a room 60 feet long and 30 feet wide [42] (Herb Grosch [59] estimates the dimensions of its "U" shape at 60 + 40 + 80 feet, 180 feet in all, about half a football field!)
http://www.columbia.edu/acis/history/ssec.html

 

1.computer stores information, however a calculator does not.

Charles Babbage FRS (26 December 1791 London, England 18 October 1871 Marylebone, London, England [1]) was an English mathematician, philosopher, and mechanical engineer who originated the idea of a programmable computer. Parts of his uncompleted mechanisms are on display in the London Science Museum. In 1991 a perfectly functioning difference engine was constructed from Babbage's original plans. Built to tolerances achievable in the 19th century, the success of the finished engine indicated that Babbage's machine would have worked. Nine years later, the Science Museum completed the printer Babbage had designed for the difference engine, an astonishingly complex device for the 19th century.
from:http://en.wikipedia.org/wiki/Charles_Babbage

WHAT IS A DATABASE (dbase)

Manipulating data (information) plays an important role in any organization today. In order to manipulate the data, information has to be stored, retrieved, modified or deleted. At any moment new data can be added to a file, or existing information can be retrieved, modified or even deleted. Instead of one file there might be several files needed to store information as well as to interact with other files (file processing). The notion of data manipulation where data may be stored, retrieved, modified or even deleted is called a database.  In addition, there are times when it is necessary to generate reports based on a certain request or computations from the database.

 what is bit:

DEFINITION - A bit (short for binary digit) is the smallest unit of data in a computer. A bit has a single binary value, either 0 or 1. Although computers usually provide instructions that can test and manipulate bits, they generally are designed to store data and execute instructions in bit multiples called bytes. In most computer systems, there are eight bits in a byte. The value of a bit is usually stored as either above or below a designated level of electrical charge in a single capacitor within a memory device.
from webpage:http://searchcio-midmarket.techtarget.com/sDefinition/0,,sid183_gci213816,00.html

 this is a picture of a byte according to Bill Parris

01000011 -

 

 

 

A JOURNEY FROM BIT TO DATABASE

 

Computer information is represented in binary form using a bit.  Each bit contains a value which is either zero or one. Eight bits represent a byte. Depending on the system one or two bytes represent a character. Several characters form a field or a string. One or more fields make up a record. Multiple records build a stream or a file. Finally several files create a database. However this naming convention may vary slightly, a string may represent the whole file or a database may contain only a single file.

 

 

BUILDING A SIMPLE DATABASE: Create, Display and Search

 

The following program illustrates how easily you can build a simple database by putting a few functions together. For the sake of simplicity, the database program will add, display and search the data immediately, with data modification and deletion performed later. In writing this program, the concern is simplicity rather than efficiency (speed of program or saving space). The three functions for this database are myappend() to add a record to the end of data file, mydisplay() to display entire records, and mysearch() to search  for a particular record.

ASSIGNMENT 3

Due for next class.

Create a database for a student information system consisting of a file with several records.  Each record will consist of the following 6 fields.  The database will be extended later on to use several files, with each file dedicate to a purpose.

1) First Name

2) Last Name

3) Id Number

4) Email Address

5) # of Credits

6) Major

You can create it using any language/database type you like.

 

 

Journal Monday February 4th, 2008

 

Items to do research on:

1- What are the main functions of a database: will be on the exam  The main functions common to all databases are Create, Read, Update, Delete.

Functions of a Database Application

Four Basic Functions of Database Applications

From http://apollo.saultc.on.ca/~fturco/courses/csd304/fall2002/ch10.htm

     The four basic functions are common to all database applications

     These basic functions are

  Create
  Read
  Update
  Delete

     The (unfortunate) acronym for these functions is CRUD

 

A View CRUD Functions –Create

     Create

 

INSERT INTO CUSTOMER

   (CUSTOMER.Name, CUSTOMER.City)

VALUES (NewCust.CUSTOMER.Name, NewCust.CUSTOMER.City)

 

A View CRUD Functions –Read

     Read

 

SELECT CUSTOMER.CustomerID, CUSTOMER.Name

FROM CUSTOMER, WORK

WHERE CUSTOMER.CustomerID = WORK.CustomerID

 

A View CRUD Functions –Update

     Update

 

INSERT INTO CUSTOMER

   (CUSTOMER.Name, CUSTOMER.City)

VALUES (NewCust.CUSTOMER.Name, NewCust.CUSTOMER.City)

 

A View CRUD Functions –Delete

     Delete

Cascading deletions depend on relationship cardinality

 

 

2- Why management should know about database.

3- What are the errors in database.

On the Department of Health and Human Services website-  The very critical issues of medical errors and patient safety have received a great deal of attention. In November 1999, the Institute of Medicine (IOM) released a report estimating that as many as 98,000 patients die as the result of medical errors in hospitals each year.  (http://www.ahrq.gov/qual/errorsix.htm

 

A) how do you add a record to Access?

In March 2000, 5.5 million searches per day, required 2,500 computers

In fall 2004, computers were about 8 times more powerful.

Estimated number of computers for 250 million searches per day:

       = (250/5.5) x 2,500/8

       = about 15,000

Some industry estimates (based on Google's capital expenditure) suggest that Google and Yahoo may have had as many as 250,000+ computers in fall 2007.

from(http://64.233.169.104/search?q=cache:uX1GnJ135XsJ:www.infosci.cornell.edu/courses/info430/2007fa/slides/lecture18.ppt+google+file+handling+millions&hl=en&ct=clnk&cd=5&gl=us)

The Google File System
Sanjay Ghemawat, Howard Gobioff, and Shun-Tak Leung
Google∗
ABSTRACT
We have designed and implemented the Google File System,
a scalable distributed file system for large distributed
data-intensive applications. It provides fault tolerance while
running on inexpensive commodity hardware, and it delivers
high aggregate performance to a large number of clients.
While sharing many of the same goals as previous distributed
file systems, our design has been driven by observations
of our application workloads and technological environment,
both current and anticipated, that reflect a marked
departure from some earlier file system assumptions. This
has led us to reexamine traditional choices and explore radically
different design points.
The file system has successfully met our storage needs.
It is widely deployed within Google as the storage platform
for the generation and processing of data used by our service
as well as research and development efforts that require
large data sets. The largest cluster to date provides hundreds
of terabytes of storage across thousands of disks on
over a thousand machines, and it is concurrently accessed
by hundreds of clients.
In this paper, we present file system interface extensions
designed to support distributed applications, discuss many
aspects of our design, and report measurements from both
micro-benchmarks and real world use.
(http://209.85.163.132/papers/gfs-sosp2003.pdf)

 

Postgres and Ingres Databases

Postgres and INGRES are open-source database products brought to us by the database research group at UC Berekely. These links provide the best resources on the Net!

 

#include <fstream>
#include<iostream>
using namespace std;
main(){
int empid,hoursworked;
float hourlyrate, grosspay;
ofstream fout ("salary.txt"); //associating fout with salary.txt
for (int i=1; i<=5; i++){ //loop for 5 employees
cout<<" ENTER THE EMPLOYEE'S ID "; //interactive data entries
cin>>empid;
cout<<" ENTER HOURS WORKED ";
cin>>hoursworked;
cout<<" ENTER THE HOURLY RATE ";
cin>>hourlyrate;
grosspay= hoursworked * hourlyrate; //compute grosspay
fout<<empid<<" "<<hoursworked <<" "<<hourlyrate<<" "
<<grosspay<<endl; //writing to a file
}//FOR
fout.close( );
return 0; }//MAIN
 

(notes from last year class) Database Bu5010
Class notes
020507

Menu:

1. Review last class

2. Assignment:

part a:

            Database selection; create menu.

part b:

            Menu with prototype

part c:

            Insertion component
            Search component

 

3. Demo employee database

 Employee. C++ Database

menu and submenu prototype.

4. Textbook discussion

( Mon First vol. and Wed Second Vol.)

5. Research

    a) name 3 databases
           i. Access
           ii.Oracle
           iii. SQL

   b) How are they different?
   c) Are they intelligent?
   d) Temporal Database

6. Exam
           
True/False( make 10 Ques.)

7. Building class Web

How the database is made?

8. Error, obstacle, problem discussion. 

Database Team
Student: Hamed and Payam
Bank: customer assistance Sharmin and Christen
Login account Ralph
Book store: selling used books; cheapest $$$ Keith and Jeffrey
Music: best choice Andrea and Nick
Insurance: lowest rate Marlene
Professor Assignments Ruan
Laptops Hakeem
Car: helping students purchase cars Nasheika

" Each time you demo you recieve 5pts."

 

 

setstats1