Summary

This document provides an introduction to database concepts such as the definition of a database, tables, records, fields, and relational databases. It also explains simple data types such as strings, fixed-length strings, and variable-length strings. The document assumes a basic understanding of computer science concepts.

Full Transcript

1 040103205 Network and Internet Programming Introduction to Database 1. What is a database? A database is a collection of related information. 2. Tables A table is a container into which data is stored. A table is a collection of data about a speci...

1 040103205 Network and Internet Programming Introduction to Database 1. What is a database? A database is a collection of related information. 2. Tables A table is a container into which data is stored. A table is a collection of data about a specific topic, such as students or doctors. Tables organize data into columns (called fields) and rows (called records). The following is an example of a table called "Books": Figure 1.4: The Books table 3. Records A record is a row in a table and is a set of values defined by fields. 4. Fields A field is a column in a table. For example, the Books table includes the fields: book_Id, book_name, author_name, and price. 2 5. The Relational Database A relational database stores data in separate tables allowing relationships to be defined between tables. Database for Faculty of Science will contain the following tables: Students, Courses, Departments, Faculty Members, Teaching Assistants, Staff 6. Relational Database Management System (RDBMS) RDBMS is a program that lets you create, update, and manage a relational database. MySQL is an example of this. 7. What is metadata? Metadata is essentially data about other data (data that describes data). Exercise 1 Show the metadata for the following table Students. Id Major Minor 12 CS Stat 19 Stat CS 26 Math CS 37 Stat CS 8. Simple data types Strings A string is a sequence of one or more characters. Strings can be fixed-length strings or variable-length strings: Fixed-length strings A fixed-length string will always store the specified length declared for the data type. If the actual string-length is less than the specified length, the value is padded with spaces. For example, the value "Hello" in a CHAR(8) variable would be stored as "Hello" plus three space characters. Fixed-length strings are generally only used for short length strings. 3 Variable-length strings A variable-length string allows storage into a data type as the actual length of the string, as long as a maximum limit is not exceeded. The length of the string is variable because when storing a string of length less than the width specified by the data type, the string is not padded. Only the actual string value is stored. 9. Primary key A primary key is used to uniquely identify each record in a table. To select a specific field as a primary key, it must satisfy the following properties: Duplicate values are not allowed. Null values (empty values) are not allowed

Use Quizgecko on...
Browser
Browser