Download Slides

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Entity–attribute–value model wikipedia , lookup

SQL wikipedia , lookup

Oracle Database wikipedia , lookup

Microsoft Access wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Concurrency control wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

PL/SQL wikipedia , lookup

Functional Database Model wikipedia , lookup

Database wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Relational model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Healthcare Cost and Utilization Project wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
Week 4 - Monday



What did we talk about last time?
Simulating motion with a computer
Lab 3

If a ball is flying through space at a speed of 4
m/s with an angle of 30° above the horizon
 What's its x velocity?
 What's its y velocity?
30°
If a ball has an x velocity of 7 m/s and a y
velocity of 3 m/s, what's its total speed?
3 m/s

7 m/s
Modern computers are used to store vast
amounts of data
 As you know, deep down it's all 1s and 0s
 To be used, data must be loaded into RAM

 Also called primary memory

But for long term storage, you can keep it on




Hard drives
Flash drives
Optical media
Tape backup
Hard drives store data in magnetic patterns with a needle
hovering above magnetically coated platters that spin at
thousands of revolutions per minute
Platter
Pros
 Inexpensive
 Mature
technology
Cons
 Vulnerable to
 Impact
 Strong magnetic
fields


Noisy and prone
to failure
because of
moving parts
Generate heat
Needle
Flash drives store data in tiny charges in floating-gate transistors
embedded in silicon
Memory
Pros
 Fast
 No moving
parts
 No noise
 Very little heat
 Low power
Cons
 Expensive
 Limited number
of times it can
be written to
 But increasing!
Controller
 Plastic disc with patterns of dark, unreflective
spots (pits) for 0 and reflective spots (lands)
for 1 created on some reflective embedded
material, often aluminum
 As the disc spins, a laser shines on its surface
 Newer optical media uses shorter wavelength
light to get higher resolution
Pros
 Very cheap
 Easy to mass
produce
Cons
 Slow
 Many forms are
ROM
 Most others can
only be written
once
Land
Pit

Most operating systems support one or more file
systems
 ext2, ext3, ext4 for Linux
 FAT32 and NTFS for Windows
 HFS for Mac
These file systems describe how files can be laid
out on a hard drive (or other storage)
 A special kind of file is called a directory

 These allow you to organize your files
 Sometimes called folders
A file is a sequence of bytes (groups of 8 bits)
A file is the typical way we organize data on our
computers
 One way to classify files is the following categories:


 Data files: they contain the text, music, videos, and other
content we create and use
▪ Word documents
▪ MP3 files
▪ Movie files
 Executable files: these files contain programs that do
things, including creating other files
▪ Microsoft Word
▪ Overwatch
▪ Google Chrome

Some files have extensions, usually 3 letters in
length
 For example: .exe, .mp3, .html

These extensions are part of the file name
 Though Windows will sometimes hide them

They have no real meaning
 You can change the extension by typing a new one

They're intended to help the user and the OS
know what kind of file they're dealing with
 When you double click on a file, there are settings in
Windows that pick which application should open a
file with a particular extension



A database is a collection of data and a set of
rules to organize the data by relationships
A database administrator makes the rules
and controls access
A database management system (DBMS) is
the program through which the user interacts
with the database


If we want to store data, we could use regular
files
But databases have many advantages:






Shared access for many users
Minimal redundancy so that space is used efficiently
Data integrity with rules that protect relationships
Controlled access with authorized users
Databases have also been heavily optimized for
speed
Users don’t need to know anything about the
actual physical layout of the database on disk

There are many DBMSs
 Oracle is an expensive corporate-grade database
 Microsoft Access is Microsoft's home and small
business database
 Microsoft SQL Server is their corporate-grade
product
 MySQL and PostgreSQL are both open source
(free!) databases
▪ Often used for webservers
▪ Weird since Oracle owns MySQL now…

Almost all modern databases use the relational
database model
 The fundamental unit of organization is a table
 An older format for databases was hierarchical, like a
tree
A table consists of rows which are records
A record consists of fields or elements, which
are each a specific item of data
 A special field which is unique for each record is
called a primary key, which is used as an ID
number


Students
ID
Name
1
Rosters
Houses
Year
House
ID
Name
Harry Potter
4
1
1
2
Draco Malfoy
4
4
3
Hermione Granger
4
4
Cho Chang
5
Cedric Diggory
Points
Student
Class
Griffindor
35
1
1
2
Ravenclaw
42
1
2
1
3
Hufflepuff
23
1
3
5
2
4
Slytherin
59
7
3
1
4
1
5
Professors
Classes
ID
Name
2
1
2
2
2
3
2
5
ID
Name
Professor
1
Albus Dumbledore
1
Potions
2
2
Severus Snape
2
Transfiguration
3
3
Minerva McGonagall
3
Care of Magical Creatures
4
4
Rubeus Hagrid
4
Divination
5
5
Sybill Trelawney
5
Defense Against the Dark Arts
6
6
Alastor Moody


A query is the name of a command given to a
database by a user
Queries can:
 Retrieve
 Modify
 Add
 Delete

Most databases allow commands to be issued
through a variant of SQL

Structured Query Language (SQL) is the
standard language for database access
 It is pronounced as "S-Q-L" or "sequel"
▪ I have even heard "squill"

Though the values in a database are casesensitive, commands in SQL are not
 Commands are often typed in ALL CAPS
The most fundamental command in SQL is SELECT
A SELECT command takes the form SELECT fields
FROM tables WHERE condition, but the WHERE part is
optional
 SELECT retrieves fields from one or more tables and
returns a new temporary table containing the data
that matches the condition


SELECT Name FROM Students WHERE House = 1;

Asterisk (*) specifies all fields (or all tables)
SELECT * FROM Houses;



Visual Python is an extension to Python that lets
us easily manipulate 3D objects
I chose Visual Python because it's easier to learn
program when you can see the effects of your
code
Any Visual Python program should have the
following line at the top of it:
from visual import *

However, GlowScript.org includes this
automatically, so it won’t be necessary for us

The box() command will make a
box
 pos, size, color are attributes

The sphere() command will make
a sphere
 pos, radius, and color are
attributes
redbox=box(pos=vector(4,2,3),
size=vector(8,4,6),color=color.red)
ball=sphere(pos=vector(4,7,3),radius=2,
color=color.green)

Write a program that:
 Initializes a variable x
 Initializes a variable y
 Initializes a variable z
 Initializes a variable radius
 Makes a blue sphere at position (x, y, z) with
radius radius



Data mining
Loops in Python
Read Python Chapter 3



Keep working on Project 1
Read Python Chapter 3
Exam 1 next Monday