473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to execute the notepad data in sql as a table

Hi

This is my first query in sql .......


I have a data like

Email id
abc@yahoo.com
bbc@yahoo.com
ccb@yahoo.com
dda@yahoo.com
.
.
.
upto 80,000



So i want to create a table in sql and to display the this data in sql and how to export this data after modification to excel or notepad any of them in word processors or spreadsheet

Pls help me any one of this query....
Regards,
Prabhakar Reddy
Jul 20 '07 #1
2 11619
mwasif
802 Expert 512MB
Create a sample table emails with a single UNIQUE column i.e. email (this will contain email address). SQL will be

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE `emails` (
  2.   `email` varchar(255) NOT NULL default '',
  3.   UNIQUE KEY `email` (`email`)
  4. ) ENGINE=MyISAM;
Use file() to read the data from text file.

[PHP]
// code to create database connection will go here
$emails = file('path/to/text/file');

foreach ( $emails as $email )
{
if( trim($email) == "" ) continue;
mysql_query("INSERT IGNORE INTO email('$email')");
}[/PHP]

I have made the email column in DB as UNIQUE and used INSERT IGNORE to avoid inserting the same email twice.

To download the data as spread sheet/csv/excel check this small article. BTW, you can open this text file in excel or any wordprocess and Save As in your required format.

Post back if you need to know more.

Note: I have not tested this code, but I hope this will work for you.
Jul 20 '07 #2
mwasif
802 Expert 512MB
Or simply use this MySQL command

Expand|Select|Wrap|Line Numbers
  1. LOAD DATA INFILE 'path/to/text/file'
  2. IGNORE INTO TABLE emails;
Jul 20 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Kevin Myers | last post by:
Hello, I'm an experienced application developer in some languages (including various SQL dialects), but have very little experience with MS Access or VBA, and am having trouble figuring out how...
8
by: Woody Splawn | last post by:
Lets say I have a winform that is populated with a dataset. The dataset and data table may have several rows in it. Lets say I am looking at the winform and I want to assign a value to a certain...
2
by: Steve Stover | last post by:
I want to use the caching API in .net to store data. The data would be stored in a data table class that has approx. 10 columns and 71 rows. What I need to know is this: According to Microsoft's...
2
by: Brian Mitchell | last post by:
Ok, I know this is an elementary question but I have a data grid that is bound to a data table and I can't seem to find a way to match the selected row in the grid with it's respective row in the...
1
by: Vasilis X | last post by:
Here is the question : I have a data table, UnShorted, which has a data column EventTime (type : date time) and a data column Values (type : single). I want to create a table, Shorted, that...
1
by: John | last post by:
Hi When using Table Adapter Configuration Wizard if 'Use SQL Statements' is selected as Command Type, the data table's name in dataset is retained and only its data adapter's select statements...
1
by: DH | last post by:
I have an untyped dataset with a table. I am trying to programmatically add a row to this table. This was working in VS 2003 / .net 1.1 I am receiving an error "Object reference not set to an...
1
by: laredotornado | last post by:
Hi, I have a data table on my page (buried amidst other images and extraneous text). I would like to spawn a new window that automatically prints the content of my data table, and only that...
4
by: indona | last post by:
hi, i have to enter data from a delimited file into sqlserver database table. i have been able to delimit the file and read the data into a data table, now i want enter the data table contents to...
1
by: BaseballGraphs | last post by:
Hello, I am trying to divide one value from my data table with an associated ID by another value from my data table with a different ID for the same day that the value was added to the data table....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.