PDA

View Full Version : Need help in SQL


AsifTheManRahman
May 29, 2004, 11:20 AM
as you know, "varchar" only allows 255...but i need a table to store people's resume's...so i need something like 1000 characters...plz let me know whether it's possible...

sadhat
May 29, 2004, 11:21 AM
Originally posted by AsifTheManRahman
as you know, "varchar" only allows 255...but i need a table to store people's resume's...so i need something like 1000 characters...plz let me know whether it's possible...
use Text type

AsifTheManRahman
May 29, 2004, 11:22 AM
thanx...i tried that...but it doesnt seem to be working...

sadhat
May 29, 2004, 11:25 AM
Originally posted by AsifTheManRahman
thanx...i tried that...but it doesnt seem to be working...
I am talking about MS Sql.

text Variable-length data with a maximum length of 2^31 - 1 characters

[Edited on 29-5-2004 by sadhat]

AsifTheManRahman
May 29, 2004, 11:26 AM
i'm talking abt mysql 3.23....any ideas?

sage
May 29, 2004, 11:26 AM
Keep the resume in text file or word file. Store the path of the text file in the field of the table. path should be less then 255 charater. Like c:\Oracle\resume\myresume.doc

[Edited on 29-5-2004 by sage]

AsifTheManRahman
May 29, 2004, 11:28 AM
ok thanx

sadhat
May 29, 2004, 11:29 AM
Originally posted by AsifTheManRahman
i'm talking abt mysql 3.23....any ideas?

You column type should be TEXT

http://dev.mysql.com/doc/mysql/en/C_API_Prepared_statement_datatypes.html

there is a table for type.

sadhat
May 29, 2004, 11:32 AM
Originally posted by sadhat
Originally posted by AsifTheManRahman
i'm talking abt mysql 3.23....any ideas?

You column type should be TEXT

http://dev.mysql.com/doc/mysql/en/C_API_Prepared_statement_datatypes.html

there is a table for type.

Well, I use TEXT type which give me lots of space to store data. Unlike varchar. Its same like MEMO type in access. I am pretty sure TEXT also works for Oracle, and MySQL

[Edited on 29-5-2004 by sadhat]

sage
May 29, 2004, 11:40 AM
Any Moderator plz ! this thread belongs to Forget Cricket. Thanks!

AsifTheManRahman
May 29, 2004, 12:18 PM
ok got it thanx sadhat

AsifTheManRahman
June 1, 2004, 06:38 PM
Can anyone give me the syntax for creating related tables in Mysql?

Nasif
June 1, 2004, 06:53 PM
Relations are created in mySQL only using foreign keys. I don't think there is a internal way to establish relations like MSSQL in mySQL. I could be wrong.

Mahmood
June 1, 2004, 07:20 PM
In MS SQL, you would use a CLOB field to store text files or a BLOB to store binary files.

AsifTheManRahman
June 2, 2004, 07:27 PM
Originally posted by nasif
Relations are created in mySQL only using foreign keys. I don't think there is a internal way to establish relations like MSSQL in mySQL. I could be wrong.

yes they are indeed created using foreign keys...could you shed some more light onto exactly how it's done?

Nasif
June 2, 2004, 07:49 PM
Here is a classic example with books and authors. A book can have one or more authors. A author can write one or more books. Its many to many relation.

Table: Books
Bookid - integer (autoindex)
Bookname - varchar

Table: Authors
Authorid - integer (autoindex)
firstname - varchar
middlename - varchar
lastname - varchar
address - varchar

Table: BookAuthor
Authorid - integer
Bookid - integer

Last table BookAuther creates a many to many realtion between Books and Authors.
--------------------------

Another example:
Here is another example. This one is from our own database. We have a cricketer database and a picture database. A cricketer can have many pictures. But a picture belongs to one and only cricketer. So it is a one to many relationship. Following is a short form from the database:

Table: Cricketers
cricketerid - interger (autoindex)
firstname - varchar
middlename - varchar
lastname - varchar


Table: Pictures
pictureid - integer (autoindex)
cricketerid - integer
url - varchar
caption - varchar

The cricketerid column relates each picture to a specific one and only one cricketer.

[Edited on 3-6-2004 by nasif]

sageX
June 3, 2004, 03:01 AM
Originally posted by nasif
Here is a classic example with books and authors. A book can have one or more authors. A author can write one or more books. Its many to many relation.

Table: Books
Bookid - integer (autoindex) [Primary Key]
Bookname - varchar

Table: Authors
Authorid - integer (autoindex)[Primary Key]
firstname - varchar
middlename - varchar
lastname - varchar
address - varchar

Table: BookAuthor
Authorid - integer [Foreign Key]
Bookid - integer [Foreign Key]


Books[Foreign Key]+Authors[Foreign Key]=>BookAuthor[Primary Key]

In relational database M:M is always implemented using Intersection table. BookAuthor is the intersection table for Books and Authors table. Every table has to have a primary key. Primary key makes an individual record uniquly identifieble.

In intersection table AuthorID and BooksID are foreign keys establishing an M:M relationship. Together they also become unique. Thus serve as primary key for the interface table.

I havn't done MySql. Above foreign key use is standard for any relational database in case of M:M.

AsifTheManRahman
June 3, 2004, 10:05 AM
Thanks a lot guys