How to run a SQL query on an Excel table

0 votes
I'm trying to create a sub-table from another table of all the last name fields sorted A-Z which have a phone number field that isn't null. I could do this pretty easy with SQL, but I have no clue how to go about running a SQL query within Excel. I'm tempted to import the data into postgresql and just query it there, but that seems a little excessive.

For what I'm trying to do, the SQL query SELECT lastname, firstname, phonenumber WHERE phonenumber IS NOT NULL ORDER BY lastname would do the trick. It seems too simple for it to be something that Excel can't do natively. How can I run a SQL query like this from within Excel?
Apr 7 in Database by Edureka
• 9,320 points
25 views

1 answer to this question.

0 votes
On Excel tables, how to construct and run SQL SELECT
On the XLTools tab, click the Execute SQL button. The editing window will appear on the screen.
A tree view of all accessible tables can be found on the left-hand side.
You can choose to select entire tables or single fields.
Choose whether the query output should be placed on a new or existing worksheet.
To begin, press the Run button.
answered Apr 11 by Edureka
• 8,820 points

Related Questions In Database

0 votes
1 answer

How to schedule a job for SQL query to run daily?

down voteaccepted Expand the SQL Server Agent node ...READ MORE

answered Oct 25, 2018 in Database by Frankie
• 9,830 points
7,639 views
0 votes
1 answer

How to schedule a job for sql query to run daily?

Hii, To schedule a job for sql query ...READ MORE

answered May 4, 2020 in Database by Niroj
• 82,680 points
733 views
0 votes
2 answers

How to select the nth row in a SQL database table?

SELECT * FROM ( SELECT ID, NAME, ROW_NUMBER() ...READ MORE

answered Apr 23, 2020 in Database by anand
• 140 points
15,478 views
0 votes
0 answers

how to create a SQL table?

Feb 1 in Database by Neha
• 6,260 points
15 views
0 votes
1 answer

How to drop all tables from a database with one SQL query?

Use the INFORMATION_SCHEMA.TABLES view to get the ...READ MORE

answered Feb 4 in Database by Neha
• 6,260 points
93 views
0 votes
1 answer

How to rename a column in a database table using SQL?

For SQL Server, use sp_rename USE AdventureWorks; GO EXEC sp_rename 'Customers.CustomerTerritory.TerritoryID', ...READ MORE

answered Feb 9 in Database by Neha
• 6,260 points
54 views
0 votes
1 answer
0 votes
0 answers

How would I use excel to generate a large update sql statement?

I know there's a way to have ...READ MORE

Mar 30 in Database by Edureka
• 9,320 points
26 views
0 votes
1 answer

How to convert a column number (e.g. 127) into an Excel column (e.g. AA)

If anyone needs to do this in ...READ MORE

answered Mar 30 in Database by Edureka
• 8,820 points
24 views
0 votes
1 answer

How to get the "Name Box" name of an Excel cell?

By typing in the Name Box, you ...READ MORE

answered Mar 15 in Database by Edureka
• 8,820 points
108 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP