What are the key difference between MySQL and MS SQL Language? [duplicate] - mysql

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Differences Between MySql and MS SQL
What is the key difference between MySQL and SQL Server from the SQL language perspective. The reason why I am asking is that I need to quickly master some basic SQL knowledge and need to find a book to start with.
I find this one through amazon.com Learning SQL, 2nd Edition, however, this book is for MySQL. All other books for MS SQL are big one that cannot be finished in a short time.
So, it is fine I just grab a MySQL book and later I can easily transfer to MS SQL world or I should immediately go into MS SQL Server?
// update the title based on the comments ///

The following links might help you out.
Note that the two are very different.
If you want to make your live easy, use PostgreSQL, the gap between that and SQL-server is much smaller.
Difference between MySQL and MSSQL
From microsoft and mysql respectively:
http://technet.microsoft.com/en-us/library/cc966396.aspx
http://www.mysql.com/why-mysql/white-papers/mysql_wp_mssql2mysql.php (login required sorry)
On stackoverflow: Differences between MySQL and SQL Server
Difference between PostgreSQL and MySQL
http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL
Difference between postgreSQL and MSSQL
On SO: https://stackoverflow.com/questions/907908/postgres-to-sql-server
and: https://stackoverflow.com/questions/4630891/tips-for-sql-server-developer-picking-up-postgresql
Diff between all three :-)
http://www.postgresonline.com/journal/archives/51-Cross-Compare-of-SQL-Server,-MySQL,-and-PostgreSQL.html
or http://troels.arvin.dk/db/rdbms/

This might be a good tutorial to start with SQL - http://philip.greenspun.com/sql/ (rather old, but valid) - though it points more to Oracle, but MySQL is mentioned there.

Related

Querying data by joining two tables in two databases (different database types) on different servers

I have a MS SQL (SQL Server 2008) database with some data in it and a postgresql (9) database with other data. I need to do some queries to find related data. I know how to link two MS SQL databases together but not sure how to even start with the mixed database types.
The new company I work for has postgresql, I have not worked with it before. The guy I replaced was really the only one here who knew much about it. So no internal resources.
I'm not ready to build a solution in code at this point (.NET), just hoping to have a tool to do some queries.
Postgresql has table
Company
Company_id, Company_name, ....
MS SQL had table
Companies
company_name, postgresql_company_id, company_id, ....
If you ever need to run queries from Postgres that pulls data from SQL-Server, you can use foreign data wrappers. The ODBC driver should work fine:
http://wiki.postgresql.org/wiki/Foreign_data_wrappers
I'm not familiar enough with SQL-Server to give an authoritative answer on how to do it the other way around, but since Postgres speaks ODBC, I'm guessing it's close enough to how you make a SQL-Server talk with another one.
Related thread: SQL Server 2012: Add a linked server to PostgreSQL

T-SQL connector for MySQL

Is there any way to use T-SQL queries with MySQL database, like having a data connector that understand TSQL and can connect to MySQL?
Short answer, no.
By the time you've developed or found an interface that could translate T-SQL syntax into MySQL (correctly); you might as well have learnt the syntax required to write the MySQL you need.
It's not all that different to be honest; and it will broaden your knowledge and make you flexible for other types of database query languages.

Are there any SQL Validators that can check syntax against multiple database servers?

Are there any SQL Validators that can check syntax against multiple database servers?
For example, I might want to check whether a particular query will work against Oracle, MySQL and SQL Server.
I am more concerned about the SQL syntax than the actual schema being queried, so a tool that can catch major syntax errors, like detecting that the limit clause is not supported in SQL Server and Oracle would be good enough.
EDIT:
Several answers have suggested checking syntax for a particular DBMS or for ANSI Standard.
What I am looking for a possibility of targeting a sort of union of features between two or more databases (say SQL Server and Oracle). I would like to be able to use any SQL feature that is supported by all of the DBMS I am targeting in a particular application.
I am not sure if it is worthwhile. I think it depends upon the number of non-ANSI features shared by several databases. If there are very few, then perhaps it will be better to target the ANSI standard.
I'm not aware of any that are that specific, these will check that the statements are valid ansi 92/99/2003...
http://developer.mimer.com/validator/index.htm
That will get you 99% of the way there (especially if are only doing CRUD operations)
maybe if you know which reserved words are used by which database you could roll your own simple checker..
see : How to find if a column name is a reserved keyword across various databases
(as already mentioned) If your goal is to create a database agnostic system think about using a third party tool e.g: entityspaces
For the MySQL: try automatic SQL syntax check feature in dbForge Studio for MySQL.
For the Oracle: PL/SQL Editor in dbForge Studio for Oracle
This is an online mysql syntax checker, but this is mysql only
http://www.piliapp.com/mysql-syntax-check/
You can use https://www.db-fiddle.com/. It supports the following DBs
MySQL 8.0
MySQL 5.7
MySQL 5.6
MySQL 5.5
PostgreSQL 13
PostgreSQL 12
PostgreSQL 11
PostgreSQL 10.0
PostgreSQL 9.6
PostgreSQL 9.5
PostgreSQL 9.4
SQLite 3.30
SQLite 3.26

Import data to mysql from oracle [duplicate]

This question already has answers here:
Migrate from Oracle to MySQL
(7 answers)
Closed 8 years ago.
I have 2 databases, the first one is a Mysql db and it is used for a website. The second one is an Oracle db and it has data that I want to show on the website and that data must be fresh, I mean, I need to execute a process to migrate data to Mysql from oracle db every 30 minutes.
Because I am talking about 60000 rows to migrate every 30 minutes, I think that optimal way to do it is something like (thinking about performance):
insert into mysql_db.table.field1, mysql_db.table.field2, mysql_db.table.field3 select oracle_db.table.field1, oracle_db.table.field2, oracle_db.table.field3 from oracle_db.table
The Oracle db is on Windows and Mysql is on Linux (Ubuntu).
Is that possible? how? else, suggest me a different way please.
Having ODBC driver for the MySQL database, you could try Data Export tool (with command line support) in dbForge Studio for Oracle.
You could also use something like GoldenGate to capture changes in oracle and apply them to the mysql database , although if this is the one use case you have, the cost of the product may not be justifiable, in which case probably just a simple perl/php/python/etc script would do the trick.
I've used HSODBC links between mysql 4 and oracle 9i and found the performance less than fantastic, hopefully things have improved, if that is the case, this may be a viable solution, however you would still need to do it as a job ( inside or out of oracle ), as I'm not aware of anyway to make calls from mysql to oracle.
Oracle support the connection between Oracle databases through DBLink. But I don't believe that exists some tool for connect a Mysql and Oracle that let you execute directly your proposed query.
I can suggest that you write an script (by example in Python or Groovy) and schedule it on CRON Linux (if this is your environment). Since the size of data you will need implement Batch Updates (it's specific to the language in which you will implement the script)

How can I use RLIKE MySQL function inside of SQL Server 2005?

I need to run a RLIKE query on a database mmoved from MySQL to SQL Server 2005 however having problems replicating the "RLIKE" functionality that MySQL provides.
Does anyone have any ideas?
Cheers,
Chris
The only way I know of to do that is to add user defined CLR functions.
To begin with, here's an MSDN Magazine article, "Regular Expressions Make Pattern Matching And Data Extraction Easier"
The code for that article, which I've been using for a couple of years now, is here.