Archive for the ‘School’ Category

Oracle Constraints

Wednesday, February 14th, 2007

Constraints are used to keep accurate data. In oracle you can apply these policies to a column or table. There are five different types of constraints:

Constraint Abbreviation Description
PRIMARY KEY _pk This is a unique field that is not allowed to have null values.
FOREIGN KEY _fk This constraint is placed in the “many” table. The data that’s entered in this field must have a value in the parent table.
UNIQUE _uk All data that is stored in a column with a UNIQUE constraint on it will not have two of the same values. This constraint is a bit different from a PRIMARY KEY where the PRIMARY KEY does not allow NULLs, a UNIQUE constraint does allow NULLs.
CHECK _ck This constraint ensures that a specified condition is true before any data is added to the table.
NOT NULL _nn This makes sure that there is a value going into the table.

(more…)

Creating and Managing Tables in Oracle 10g

Wednesday, February 14th, 2007

When creating tables in Oracle we have to follow some rules in order to successfully create a table:

  • Table names and columns can be up to 30 characters long.
  • Names of tables and columns cannot have any blank spaces.
  • Numbers, underscores, and number signs are allowed in the table and column name.
  • Each table that a user owns must have a unique name and each column in that table must have a unique column name.
  • You can’t use reserved keywords as a table or column name.

(more…)

Finding the Median

Wednesday, January 31st, 2007

Sometimes the median can be confused with the average. In statics the median is where the typical person falls. We don’t say average because when averaging, the average is often skewed because any large numbers used will pull the average away from where the middle person actually is. For example:

Raw Data

0 - 5 5, 3, 2, 3, 4, 3, 5
6 - 10 6, 6, 6, 9, 8, 7, 6, 7, 9, 6, 10, 7, 8, 9, 6, 6, 7, 7, 8
11 - 15 11, 12, 13, 14, 14, 13
16 - 20 16, 17, 17
21+ 23

Distributed Data

The next step is to figure out how many people fit in each category.

Number of Miles Driven # of People %
0 - 5 7 19%
6 - 10 19 53%
11 - 15 6 17%
16 - 20 3 8%
21 + 1 3%
Total 36 100%

Finding the Middle Person

The equation to find the middle person is simple. All we need to do is find the total number of people, which is 36 in this case. We ad one to the total number of people and then divid that by 2.

L = ( n + 1 ) / 2

L = the lower end of the category that contains the middle person. The middle person will be 18.5.
n = total number of people, 36.
CF = total number of people in the category or categories that come before the category containing the middle person. Since 18.5 falls in the “6 - 10 miles” category this number will be 7. If there were two or more categories before this one, then we would add the number of people in each category together to get this value.
f = the number of people in the category containing the middle person. The number of people in this category is 19.
i = the interval of the range of the category that has the middle person to the category after it. For this instance the interval is 5 because 11 - 6 = 5.

Now we can type it into our graphing calculators to get:

18.5 + ( ( ( 36 / 2 ) - 7 ) / 19 ) * 5 = 21.39473684