Reading Data,Data Structure and Database
1.Data
(1)Distinct pieces of information,usually formatted in a special way.All software is divided into two general categories:data and programs.Programs are collections of instructions for manipu-lating data.
Data can exist in a variety of forms-as numbers or text on pieces of paper,as bits and bytes stored in electronic memory,or as facts stored in a person’s mind.
Strictly speaking,data is the plural of datum,a single piece of information.In practice,how-ever,people use data as both the singular and plural form of the word.
(2)The term data is often used to distinguish binary machine-readable information from textual human-readable information.For example,some applications make a distinction between data files(files that contain binary data)and text files(files that contain ASCII data).
(3)In database management systems,data files are the files that store the database informa-tion,whereas other files,such as index files and data dictionaries,store administrative information,known as metadata.
2.Data Structure
In computer science,a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.
Different kinds of data structures are suited to different kinds of applications,and some are highly specialized to specific tasks.For example,B-trees are particularly well-suited for implementa-tion of databases,while compiler implementations usually use hash tables to look up identifiers.
Data structures provide a means to manage large amounts of data efficiently,such as large data-bases and Internet indexing services.Usually,efficient data structures are a key to designing effi-cient algorithms.Some formal design methods and programming languages emphasize data struc-tures,rather than algorithms,as the key organizing factor in software design.Storing and retrieving can be carried out on data stored in both main memory and in secondary memory.
2.1 Basic types
An array stores a number of elements in a specific order.They are accessed using an integer to specify which element is required(although the elements may be of almost any type).Arrays may be fixed-length or expandable.
● Records are among the simplest data structures.A record is a value that contains other val-ues,typically in fixed number and sequence and typically indexed by names.The elements of records are usually called fields or members.
● A hash table(also called a dictionary or map)is a more flexible variation on a record,in which name-value pairs can be added and deleted freely.
● A union type specifies which of a number of permitted primitive types may be stored in its in-stances,e.g.“float or long integer”.Contrast with a record,which could be defined to con-tain a float and an integer;whereas,in a union,there is only one value at a time.
● A tagged union(also called a variant,variant record,discriminated union,or disjoint union)contains an additional field indicating its current type,for enhanced type safety.
● A set is an abstract data structure that can store specific values,without any particular order,and with no repeated values.Values themselves are not retrieved from sets,rather one tests a value for membership to obtain a boolean“in”or“not in”.
● Graphs and trees are linked abstract data structures composed of nodes.Each node contains a value and also one or more pointers to other nodes.Graphs can be used to represent net-works,while trees are generally used for sorting and searching,having their nodes arranged in some relative order based on their values.
● An object contains data fields,like a record,and also contains program code fragments for accessing or modifying those fields.Data structures not containing code,like those above,are called plain old data structures.
Many others are possible,but they tend to be further variations and compounds of the above.
2.2 Basic principles
Data structures are generally based on the ability of a computer to fetch and store data at any place in its memory,specified by an address—a bit string that can be itself stored in memory and manipulated by the program.Thus the record and array data structures are based on computing the addresses of data items with arithmetic operations;while the linked data structures are based on sto-ring addresses of data items within the structure itself.Many data structures use both principles,sometimes combined in non-trivial ways(as in XOR linking).
The implementation of a datastructure usually requires writing a set of procedures that create and manipulate instances of that structure.The efficiency of a data structure cannot be analyzed sep-arately from those operations.This observation motivates the theoretical concept of an abstract data type,a data structure that is defined indirectly by the operations that may be performed on it,and the mathematical properties of those operations(including their space and time cost).
3.Database
Often abbreviated DB.A collection of information organized in such a way that a computer pro-gram can quickly select desired pieces of data.You can think of a database as an electronic filing system.
Traditional databases are organized byfields,records,and files.A field is a single piece of in-formation;a record is one complete set of fields;and a file is a collection of records.For example,a telephone book is analogous to a file.It contains a list of records,each of which consists of three fields:name,address,and telephone number.
An alternative concept in database design is known as Hypertext.In a Hypertext database,any object,whether it be a piece of text,a picture,or a film,can be linked to any other object.Hyper-text databases are particularly useful for organizing large amounts of disparate information,but they are not designed for numerical analysis.
To access information from a database,you need a database management system(DBMS).This is a collection of programs that enables you to enter,organize,and select data in a data-base.
4.Database Management System
A collection of programs that enables you to store,modify,and extract information from a data-base.There are many different types of DBMSs,ranging from small systems that run on personal computers to huge systems that run on main frames.The following are examples of database applica-tions:
●computerized library systems
●automated teller machines
●flight reservation systems
●computerized parts inventory systems
From a technical standpoint,DBMSs can differ widely.The terms relational,network,flat,and hierarchical all refer to the way a DBMS organizes information internally.The internal organiza-tion can affect how quickly and flexibly you can extract information.
Requests for information from a database are made in the form of a query,which is a stylized question.For example,the query
SELECT ALL WHERE NAME="SMITH"AND AGE>35
requests all records in which the NAME field is SMITH and the AGE field is greater than 35.The set of rules for constructing queries is known as a query language.Different DBMSs support dif-ferent query languages,although there is a semi-standardized query language called SQL(structured query language).Sophisticated languages for managing database systems are called fourth-generation languages,or 4GLs for short.
The information from a database can be presented in a variety of formats.Most DBMSs in-clude a report writer program that enables you to output data in the form of a report.Many DBMSs also include a graphics component that enables you to output information in the form of graphs and charts.
5.RDBMS
Short for relational database management system and pronounced as separate letters,a type ofdatabase management system(DBMS)stores data in the form of related tables.Relational databases are powerful because they require few assumptions about how data is related or how it will be extrac-ted from the database.As a result,the same database can be viewed in many different ways.
An important feature of relational systems is that a single database can be spread across several tables.This differs from flat-file databases,in which each database is self-contained in a single table.
Almost all full-scale database systems are RDBMSs.Small database systems,however,use oth-er designs that provide less flexibility in posing queries.
divide into 分为……
be suited to 适合
data file 数据文件
index file 索引文件
data dictionary 数据字典
data structure 数据结构
hash table 哈希表
look up 查找
carry out 进行,举行,发生
secondary memory 辅助存储器
long integer 长整形
tagged union 标签联合
discriminated union 可区分联合
disjoint union 分割联合
data field 数据域,数据字段
plain old data structure 纯旧数据结构
bit string 位串
numerical analysis 数字分析
flight reservation system 机票预订系统
computerized parts inventory system 计算机零部件库房管理系统
query language 查询语言
flat-file database 平面文件数据库
B-tree(Binary Tree) 二叉树
XOR(Exclusive OR) “异”或(逻辑运算)
DB(DataBase) 数据库
DBMS(DataBase Management System) 数据库管理系统
SQL(Structured Query Language) 结构化查询语言
4GL(fourth-generation language) 第四代语言
RDBMS(Relational DataBase Management System) 关系数据库管理系统