各种数据库sql比较 postgres、mysql、oracle、sqlserver

日期差异:

gbase: current

postgres: now()

mysql: now()

oracle: sysdate

dm: sysdate

sqlserver: GETDATE()

查序列差异:

if (dialect instanceof OracleDialect) {
            query = session.createSQLQuery("select " + seqName + ".nextval as seq from dual");
        } else if (dialect instanceof MySQLDialect) {
            query = session.createSQLQuery("SELECT seq(?)");
            query.setParameter(0, seqName);
        } else if (dialect instanceof InformixDialect) {
            query = session.createSQLQuery("select " + seqName + ".nextval as seq from sysmaster\\:sysdual");
        } else if (dialect instanceof PostgreSQL81Dialect) {
            query = session.createSQLQuery("select nextval( '" + seqName + "') as seq;");
        } else {
            session.beginTransaction();
            session.createSQLQuery("update seq set val=val+1 where name=?").setParameter(0, seqName).executeUpdate();
            session.getTransaction().commit();
            query = session.createSQLQuery("select val from seq where name=?");
            query.setParameter(0, seqName);
        }

sql函数差异:

oracle不支持limit

你可能感兴趣的:(mySql,数据库)