一.常用的查询语句 1.1 常用查询 查表中有多少个字段 select count(*) from user_tab_columns where table_name=upper('表名') 或者 select max(column_id) from user_tab_columns where table_name=upper('表名') 1.2 日期/时间 相关查询 获取当前月份的第一天 SELECT TRUNC (SYSDATE, 'MONTH') "First day of curren…
package sqltest; import java.sql.*; import parameter.BaseCanShu; public class PublicDbOracle { static String id = ""; static int status = 0; static Connection con = null;// 创建一个数据库连接 static PreparedStatement pre = null;// 创建预编译语句对象,一般都是用这个而不用Sta…
1.说明:复制表(只复制结构,源表名:a 新表名:b) (Access可用)法一:select * into b from a where 1 <>1法二:select top 0 * into b from a 2.说明:拷贝表(拷贝数据,源表名:a 目标表名:b) (Access可用)insert into b(a, b, c) select d,e,f from a; 3.说明:跨数据库之间表的拷贝(具体数据使用绝对路径) (Access可用)insert into b(a, b, c)…
1.从一个表选出数据更新另一个表(后面的exists一定要加) update jqhdzt set shid = (select shid from v_plat_userjqinfo t where jqhdzt.jqbh = t.JQBH and jqhdzt.shid <> t.SHID) ' from v_plat_userjqinfo t where jqhdzt.jqbh = t.JQBH and jqhdzt.shid <> t.SHID) 2.查询字段值相同的记录总…