Jump to content

How to get to know a database?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

#1
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts
So I have this mysql database on my homeserver.
I have to start developing the php-website which uses this database.

No comments or documentation .. really messed up.

Any tips on how to get started ?
Anything on how to understand the database structure ? Something to make it graphical or .. (just guessing now)

Anything really..

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
You can use phpMyAdmin for database management. It is a web-based database administration tool and is really easy to use. As for getting to know MySQL, I suggest picking up a book and reading tutorials on the web. I've got MySQL 5.0 Certification Study Guide which isn't a bad book at all (although a bit boring).

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
To start with, do you know SQL? That's that first place you have to go. If you're looking for a graphical interface, that suggests to me that you don't know how to interact with a database other than Access (which is junk).
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
No book comes close to good old fashion practice imo! :thumbup:

#5
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I agree but you must first learn how to practice.

#6
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts
ok
so the following I have some knowledge of: SQL, phpMyadmin and PHP

My actual problem is that the database is huge(a few dozen tables)
Since I wanna learn how the db is built, I thought there propably is a better way then just go though every table and make the connections as I go .. huge job

#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
I would start with a list of tables and fields. Once that is done, you can look at sample data to get an idea of how everything hooks together. Usually field/table names will be a big clue.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#8
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts

WingedPanther said:

I would start with a list of tables and fields. Once that is done, you can look at sample data to get an idea of how everything hooks together. Usually field/table names will be a big clue.

You wouldn't happen to know any handy way of listing them .. in mysql console or with php or whatever ..

#9
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
List all the tables, in that query for each table query and get 1 row from there and print it out and see the design or something

<?PHP
//CONNECT HERE!!
$query = mysql_query("SHOW TABLES");
while($row=mysql_fetch_assoc($query)) {
	$one = array_pop($row);
	$q = mysql_query("SELECT * FROM `$one` LIMIT 1") or die (mysql_error());
	while($r=mysql_fetch_assoc($q)) {
		$s .= "<hr>".$one."<br />";
		$s .=print_r($r, true);
	}
}
?>
<pre><?=$s?></pre>


#10
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
MySQL makes it easy to get info about the database from the console.
MySQL :: MySQL 5.0 Reference Manual :: 12.5.5.34 SHOW TABLES Syntax
MySQL :: MySQL 5.0 Reference Manual :: 12.5.5.5 SHOW COLUMNS Syntax
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#11
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts

BlaineSch said:

List all the tables, in that query for each table query and get 1 row from there and print it out and see the design or something

<?PHP

//CONNECT HERE!!

$query = mysql_query("SHOW TABLES");

while($row=mysql_fetch_assoc($query)) {

	$one = array_pop($row);

	$q = mysql_query("SELECT * FROM `$one` LIMIT 1") or die (mysql_error());

	while($r=mysql_fetch_assoc($q)) {

		$s .= "<hr>".$one."<br />";

		$s .=print_r($r, true);

	}

}

?>

<pre><?=$s?></pre>

this looks about right
many thanks