Showing posts with label sistem basis data. Show all posts
Showing posts with label sistem basis data. Show all posts

Wednesday, January 13, 2010

MySQL Instruction

Download this material
Steps following in do MySQL instruction at Command Prompt

Activating Command Prompt   Start> Run> Type “ cmd ” or “ command prompt ”> OK
Activating Mysql C:>”Files's program>xampp>mysql>bin>mysql. exe ” –u root –p then enter
Making Database mysql> create is database nama_database ;
For example make rumah_sakit database:  mysql> create is rumah_sakit database;

Cheque Database mysql> show database;
Erasing Database mysql> drop database nama_database ;
For example erase rumah_sakit database:  mysql> drop rumah_sakit database;
Activating Database mysql> use database_name;
For example activate rumah_sakit database:  mysql> use rumah_sakit;

Making table
For example wants to make data_saya table with field: 
no., data type is integer,long 2
name,varchar's data type,long 10
address,varchar's data type,long 15
mysql> create table data_saya
-> (
-> no. int (2 ),
-> name varchar(10),
-> address varchar(15)
-> );

Seeing table in active database mysql> show tables;
Seeing table in database that don't active mysql> show tables from database_name;
For example sees from rumah_sakit database:  mysql> show tables from rumah_sakit;

Seeing table structure in active database mysql> desc nama_tabel;
For example see data_saya table structure:  mysql> desc rumah_sakit;
Seeing table structure in database that don't active  mysql> show fields from table_nama from database_name ;
For example see data_saya table of rumah_sakit database:  mysql> show fields from data_saya from rumah_sakit;

Changing table structure
For example wants to rename no. to number, making it as primary and not null:
mysql> alter table data_saya
-> change no. number
-> int (2 )
-> primary
-> not null;

Changing table name
For example wants to rename data_saya as data_ku
mysql> alter table data_saya
-> rename data_ku

Filling Record in Active Database mysql> insert into table_name values(‘ field1 ’ ,’ field field ’,dst);
Example fills data_saya with 1,ryan,jogja
mysql> insert into data_saya values (1,’ryan’,’jogja’);

Featuring Record mysql> select *from table_name;
For example features record data_saya:  mysql> select * from data_saya;
Download this material

Friday, January 8, 2010

Normalization Example

Example processes normalization of table:

Normalization form 1: 
A relationship accomplishes 1NF if and only if each attribute of that relationship just have singles point in a line or record.

Normalization form 2:
A relationship accomplishes 2NF if and only if:
  1. 1NF's pock.
  2. Each attribute which don't main key depend functionally to all key attribute and be not just play favorites attribute.

Normalization form 3:
A relationship accomplishes to form 3NF if and only if:
a.       That relationship 2NF's pock
b.      Each attribute doesn't key not pending functionally goes to attribute don't key the other in that relationship

Finally all table was normal. To download Normalization example  here in.

Wednesday, January 6, 2010

Agregate Function

Agregate's function it specified statistic function on row that is sorted. 
Function that often been utilized:
a.       AVG  _ to look for average point
Instruction: SELECT AVG (column_name) FROM (table_name)
b.      MAX  _ to look for greatest point
Instruction: SELECT MAX (column_name) FROM (table_name)
c.       MIN  _ to look for point most little
Instruction: SELECT MIN (column_name) FROM (table_name)
d.      SUM  _ to account amount of a field
Instruction: SELECT SUM (column_name) FROM (table_name)
e.       COUNT  _ to account record's amount
Instruction: SELECT COUNT (column_name) FROM (table_name)

Example:
1.      Looking for SKS'S maximal point of college student table?
SELECT MAX (SKS) FROM is college student
2.      Looking for SKS'S average value of college student table?
SELECT AVG (SKS) FROM is college student
3.      Look for total SKS'S point of college student table?
SELECT SUM (SKS) FROM is college student
4.      Account total college student of college student table?
SELECT COUNT (kd_mahasiswa) FROM is college student
5.      Account total appreciative college student SKS is more than 50?
SELECT COUNT (kd_mahasiswa) FROM is WHERE SKS'S college student>50
6.      Account total college student that gets address at ‘ Yogyakarta ’?
SELECT COUNT (kd_mahasiswa) FROM is WHERE'S college student alamat= ’ Yogyakarta ’

To download material Agregate's function  can click herein