Fake mysql server to run sql commands on for practice - sql

I am trying to get better with SQL commands, but I really do not have a database currently set up that I can practice on. Does anyone know of an all-in-one program or an online service that has a database set up and filled with data that I could practice my SQL commands on/in?

Frankly, I do not really know of any GOOD online site for doing this.
Google gave me this site but i tried it out and its really a bit cumbersome and difficult to work with.
I would really suggest that you will find it a LOT easier to install some database like MySQL / SQL Server Express on your machine and try things out.
Installing something like SQL Server Express is really easy. You can just download the db + tools from here, a quick install and you will be all set to go
For the sample data, you can always download the Adventureworks database.
Step by step details on how to get the AdventureWorks database running with SQL Express are listed here

Google's your friend
http://www.mysqltutorial.org/mysql-sample-database.aspx

I found this site pretty much helping.
http://sqlzoo.net/wiki/SELECT_basics
Although they use mariaDB still same queries.. So no worries.

Related

SQL Server 2017 OPENROWSET with Excel 2016

I am completely baffled by SQL Server and OPENROWSET permissions.
Our team has an AD Group. This group is included in the DEV server's Windows Administrators local group. This same AD group has SysAdmin privilege on the local installation of SQL Server 2017.
Attempting to run the command:
SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:\Work\test.xls;HDR=YES',['sheet1$'])
works for me, but for none of my teammates.
If there is a definitive document on the security requirements for using the OPENROWSET command - I have not found it (and please - don't refer me to learn.microsoft.com - that documentation is not written in any way that I understand).
There are other issues I have found including if I change the name of the sheet in the Excel workbook - the command fails (and yes - I closed the book after making the change).
Finally - some feedback on the use of OPENROWSET - is it generally a good idea? a bad idea? pretty much neutral but be prepared for these kinds of problems?
I hope this question is specific enough to be answered - I have probably spent 20+ hours trying to figure out how to understand how this works so I can make it work and use it consistently.
Thanks!
So honestly troubleshooting security/permissions and errors with SQL Server is probably the most frustrating aspects of my job.
First few questions and thoughts about your dilemma.
Do you really want to be granting your team connected to your db
sysadmin rights? I wouldn't do that period, full-stop.
Will the data be refreshed? If yes, I suggest you ingest this data
into a sql table with a process, perhaps python, ssis, dts package,
powershell, whatever you fancy.
If the data will always be static in that one excel file, I'd suggest perhaps making it act like a linked server for (hopefully) fewer permission issues? Also, it's easier to query that way, from my memory.
In any event, this article (non msdn link) may help? I've done it this way once before and had slightly less of a difficult time, but then again it involves adding a driver (usually) to the sql server. BUT, then I did not have to allow multiple users sysadmin - and I think ANYTHING is better than that.
https://www.sqlshack.com/query-excel-data-using-sql-server-linked-servers/
Sometimes the issue is not with the user running the query, but SQL Server using the account it runs as - to get permissions on the file. This article goes over that aspect as well. I'm not sure that is your issue as you say it works for me but not for thee, but maybe read that portion of the article at least?

how to create a local offline sqlplus database from an sql file?

I'm in a database class and the teacher wants us to connect through ssh to an oracle database setup on a school server and it's been extremely frustrating. She wants us to turn in an sql file that will create all the necessary table, insert tuples, run certain select commands which I've found to be very hard to get an sql file with everything after i get everything right and I haven't found a way to test the sql file against the server and I don't think I have permission to drop tables anyway. Anyway my question is there a way I can take an sql file with create table and insert commands to convert it to something like an access .mba database or something local i can mess around with? and help would be greatly appreciated didn't find much help on google.
You seem to be confusing terminology a bit; SQL*Plus is a client application, and the database is a shared server resource. You want to create schema objects from an SQL file, I think. But anyway...
There's a very useful online resource for experimenting with bits of SQL in various flavours, SQL Fiddle. Technically not 'offline' of course, but I'm taking that to mean off your school's network, not necessarily completely isolated. You can create tables and run your inserts in the schema panel, and then run queries against that. Make sure you pick the right database product from the drop-down menu so you're using syntax that is valid for your class. You'll see a lot of answers here with links to demonstration fiddles.
That's great for a lot of things but if you want something a bit more robust and scalable, and entirely offline, you can install VirtualBox and get a pre-built developer VM image which gives you a ready-to-go Linux environment with a database installed and running. You can run whatever you want against that, you have SQL*Plus and SQL Developer available, and you can connect to the DB from your host machine if you want to. You can create and test your scripts against that, and in a format that will be closer to what you have to hand in than you'd use with SQL Fiddle.
This is much less work than installing the Oracle software yourself and learning how to create and manage the database, which I'm guessing is a bit more advanced than you need at the moment, based purely on the kinds of thing your question suggests you're dong at the moment. I think you'd learn a lot from the installation and build process, but I'd get comfortable with Oracle first, and maybe practice in a VM first as it's so much easier to trash it and start again when you mess something up.
If I wanted 'something local I can mess around with', I would go for a VM image. Mo posted a walkthrough of the VM setup as a comment to a previous similar answer, which you might find helpful.
"Something local I can mess around with" in terms of Oracle Database is Oracle Database 11g Express Edition. It's free and can be downloaded from oracle.com. You certainly can test sql-files run through sqlplus on Oracle Database XE.
To get the MS Access (GUI) feeling, download SQL Developer. It's free.
Best of luck!
Bjarte

Are there any issues and/or gotchas going from SQL Server Express 2008 to SQL Azure?

I'm sure there are, I'm wondering what they are and if there is any upgrade/conversion documentation relative to taking a standard SQL server database and moving it to SQL Azure.
In addition to Jason's link, you should check out these links:
http://msdn.microsoft.com/en-us/library/ff394115.aspx
http://msdn.microsoft.com/en-us/library/ee336250.aspx
See if there's any features you're using that's missing. If not, go go go :-)
I would try running the SQL Azure Migration Wizard to check if there's anything that's not obvious that you might have missed.

Need remote or web-based MS Access SQL tool (e.g. similar to PhpMyAdmin, but ColdFusion-based)

I've been looking all over the web for a ColdFusion-based SQL administration tool for Microsoft Access and I can't find one that's simple, free and allows running SQL statements. Any suggestions?
Thanks for the recommends, guys, I'll try SQLSurfer. (MSSSME won't work for me.)
"DISCLAIMER: Using MS Access in a (web based) production environment is not recommended."
I understand that, and part of my timeline for this website is to migrate the database to MySQL on our server.
My primary interest in this is to be able to fool around with SQL commands LOCALLY so I can modify some tables. I wouldn't use this in a production environment anyway, especially not one that already has MySQL admin (Don't worry, I have plenty of backups in case I screw something up).
DISCLAIMER: Using MS Access in a (web based) production environment is not recommended.
That said, I have to admit that there are projects, customers, etc. where you can't get around having to deal with MS Access Databases the one or other way.
There is an Open Source project on RIAForge, called SQLSurfer which is a web-based ad-hoc query tool powered by ColdFusion. It is a simple way to execute SQL statements on your database (not restricted to MS Access). http://sqlsurfer.riaforge.org/ Actually there is no download link, but you can still get the code from SVN repo. http://svn.riaforge.org/sqlsurfer/
I have been working with an earlier version for a long time and I find it useful for executing prepared SQL statements. It is a very dangerous tool, especially in production, so I'd strictly recommend to include it in a password protected administration environment and deny public access.
Can RDS satisfy your needs? works with CFEclipse / CFBuilder.
Take a look at SQL Server Management Studio Express - though I've not used it with MS Access, so can't guarantee it'll work.
Hopefully someone more experienced with the two can come along and give more details.
You can easily make one your self.
On Adobe's website you can find at least 5 of those tutorials Here's one http://www.adobe.com/devnet/flex/articles/f4cf_firstapp_part1.html which uses Apache Derby, similar to MS Access.
Of course you need to think some things through, like authentication, making some field for writting SQL statement which is going to be sent as cfquery, but it should be a nice experience to make you'r own "phpMyAdmin" ;)
For MySQL there is CFMyAdmin.com. It might connect or could be adapted to tonnect to MS Access as well. I agree with Henry though, I'd set up the DSN for your access database, the RDS conection in CFBuilder and then use the query tool.
Other alternatives might be Lita (Mac based), or a FireFox add on like Sqlite Manager. They may surprise you as to what they can open.
Also, Charlie Arehart has a long list of CF based SQL Query tools. Maybe one of them could help: http://www.carehart.org/cf411/#query
Good luck

Profiler for Sql CE

i wonder if there is something similar to Sql Profiler for Sql Server Compact Edition?
i use SqlCE as backend for a desktop application and it would be really great to have something like sql profiler for this embedded database.
or at least something simliar to the NHibernate show_sql feature...
any ideas?
thanks
j.
The only tested solution I know of that could solve this problem is Altiris Profiler which is a tool I designed at my previous job, but is closed source and not-for-sale.
The way you would hook it in, is by creating a factory for your commands and proxing them for profiling purposes before using them (using RealProxy). Its really light weight and about 10 lines of code to implement.
On my question Flory talks about a new tool called dynaTrace that may also be able to solve this problem as well.
I don't think that would work - CE seems like a totally different beast.
You can enable some logging that might help you:
http://msdn.microsoft.com/en-us/library/ms171949(SQL.90).aspx
I tried to do this and managed to set the database up and connect from SSMS - you have to specify the alternate connection type of 'SQL Server Compact Edition'. Profiler has no such thing - and entering a path to the datafile for the 'database' field did nothing.
Try to install a Standard version (with the profiler) and you might be able to connect to the CE instance also.
I think that its possible that it could be done using the Default Profiler Trace Template (from Visual Studio 2008). I talk about using the template for a non-CE version of SQL in my weblog at: http://codingathome.blogspot.com/2009/04/create-sql-trace-and-read-it-using-sql.html .
Its possible that template would work for the CE version of SQL. I haven't tried it. Your milage might vary. I know that SQL CE doesn't support stored procedures so chances are this wont work. You might have to setup debugging in your code in order to trace queries.
Since CE doesn't support a stored procedure I bet you can still run the script as a .sql script and get the tracing events installed. Its worth a try.