combine multi tables to one table in MS access 2013 - ms-access-2013

I have 7 tables of information, all tables have the same fields. I would like to combine the tables into 1 master table and then make a report and show this master table on the report.
Any and all assistance would be greatly appreciated.

You are looking for the sql query for that?
CREATE Master_Table as (
SELECT * FROM Table1
UNION ALL
SELECT * FROM Table2
UNION ALL
SELECT * FROM Table3
...........)
That is if all the tables has the exact same fields(number and type)

Related

Query to find the count of columns for all tables in impala/hive on Hue

I am trying to fetch a count of total columns for a list of individual tables/views from Impala from the same schema.
however i wanted to scan through all the tables from that schema to capture the columns in a single query ?
i have already performed a similar excercise from Oracle Exadata ,however since i a new to Impala is there a way to capture ?
Oracle Exadata query i used
select owner, table_name as view_name, count(*) as counts
from dba_tab_cols /*DBA_TABLES_COLUMNS*/
where (owner, table_name) in
(
select owner, view_name
from dba_views /*DBA_VIEWS*/
where 1=1
and owner='DESIRED_SCHEMA_NAME'
)
group by owner ,table_name
order by counts desc;
Impala
In Hive v.3.0 and up, you have INFORMATION_SCHEMA db that can be queried from Hue to get column info that you need.
Impala is still behind, with JIRAs IMPALA-554 Implement INFORMATION_SCHEMA in Impala and IMPALA-1761 still unresolved.

Why reading from some table in Oracle slower than other table in the same database

I am doing a simple Select col1, col2, col22 from Table1 order by col1 and the same Select statement in Table2. Select col1, col2, col22 from Table2 order by col1.
I use Pentaho ETL tool to replicate data from Oracle 19c to SQL Server. Reading from Table1 is much much slower than reading from Table2. Both have almost the same number for columns and almost the same number for rows. Both exist in the same schema. Table1 is being read at 10 rows per sec while Table2 is being read at 1000 rows a sec.
What can cause this slowness?
Are the indexes the same on the two tables? It's possible Oracle is using a fast full index scan (like a skinny version of the table) if an index covers all the relevant columns in one table, or may be using a full index scan to pre-sort by COL1. Check the execution plans to make sure the statements are using the same access methods:
explain plan for select ...;
select * from table(dbms_xplan.display);
Are the table segment sizes the same? Although the data could be the same, occasionally a table can have a lot of wasted space. For example, if the table used to contain a billion rows, and then 99.9% of the rows were deleted, but the table was never rebuilt. Compare the segment sizes with a query like this:
select segment_name, sum(bytes)/1024/1024 mb
from all_segments
where segment_name in ('TABLE1', 'TABLE2')
It depends on many factors.
The first things I would check are the table indexes:
select
uic.table_name,
uic.index_name,
utc.column_name
from USER_TAB_COLUMNS UTC,
USER_IND_COLUMNS UIC
where utc.table_name = uic.table_name
and utc.column_name = uic.column_name
and utc.table_name in ('TABLE1', 'TABLE2')
order by 1, 2, 3;

updating a table in VFP

There are two tables in my database. I am trying to update a column in table2 by setting it equal to one of the columns in table1. I've already looked at this answer visual foxpro - need to update table from another table
And tried to do this on my code, however, I kept having a syntax error on UPDATE table2. Why?
Here is what I have.
ALTER TABLE table2;
ADD COLUMN base2 B(8,2);
UPDATE table2
WHERE table2.itemid=table1.itemid from table1;
SET table2.base2=table1.base;
The simplest syntax is:
update table2 from table1 where table2.itemid = table1.itemid ;
set table2.base2 = table1.base
You could also add more fields to update separated by commas, i.e.
... set table2.base2 = table1.base, table2.this = table1.that
Using 'standard' VFP language syntax and RELATED Tables, you could quite easily do the following:
USE Table1 IN 0 EXCLUSIVE
SELECT Table1
INDEX ON ID TAG ID && Create Index on ID field
USE Table2 IN 0
SELECT Table2
SET RELATION TO ID INTO Table1
REPLACE ALL Table2.ID WITH Table1.ID FOR !EMPTY(Table2.ID)
You might want to spend some time looking over the free, on-line tutorial videos at: Learn Visual Foxpro # garfieldhudson.com
The videos named:
* Building a Simple Application - Pt. 5
and
* Q&A: Using Related Tables In A Report
Both discuss using VFP's language to work with Related Tables
Good Luck
Use join
Update table2 b
Join table1 a on b. Itemid=a.itemid
Set b. Base2=a.base

How to get comments for table & column from oracle DB from its metadata?

I am working on a Java Application. I have connected to an Oracle DB using JDBC Connection and fetched it metadata. I am fetch information like tables, columns, views, etc from its metadata.
Now I want to fetch Comments for tables and columns separately in the application from metadata.
How can I fetch this details?
Now I want to fetch Comments for tables and columns separately in the application from metadata. How can I fetch this details?
For table comments, use [DBA|ALL|USER]_TAB_COMMENTS view.
Example:
SQL> SELECT table_name,
2 comments
3 FROM dba_tab_comments
4 WHERE owner ='OE'
5 AND table_name='INVENTORIES';
TABLE_NAME COMMENTS
----------- ---------------------------------------------------------------
INVENTORIES Tracks availability of products by product_it and warehouse_id.
For column comments, use [DBA|ALL|USER]_COL_COMMENTS view.
SQL> SELECT table_name,
2 column_name,
3 comments
4 FROM dba_col_comments
5 WHERE owner ='OE'
6 AND table_name='INVENTORIES';
TABLE_NAME COLUMN_NAME COMMENTS
----------- -------------------- ----------------------------------------------------------------------------
INVENTORIES PRODUCT_ID Part of concatenated primary key, references product_information.product_id.
INVENTORIES WAREHOUSE_ID Part of concatenated primary key, references warehouses.warehouse_id.
INVENTORIES QUANTITY_ON_HAND
SELECT *
FROM user_tab_comments;
SELECT *
FROM user_col_comments;
You can also use all|dba prefix instead of user.
Try dbms_metadata package. With it you can extract comments, grants and other things from db.
SELECT DBMS_METADATA.GET_DEPENDENT_DDL('COMMENT','TABLE_NAME','SCHEMA') FROM DUAL
if the other answers didn't work you should probably try:
Retrieving comments from tables and views
SELECT * FROM ALL_TAB_COMMENTS
Retrieving comments from Columns
SELECT * FROM ALL_COL_COMMENTS
This worked for me in an Oracle-RDS (AWS).

Updating a SQL table where items to change are identified in another table that is linked

Everywhere I look I can find how to update a table from data in another table but I am not looking for that. I have two tables TABLE1 and TABLE2. TABLE1 has a column PULLDATE and a column JOBNMBR. TABLE2 has a column JOBNMBR and a column PROJECT. The two tables link at the JOBNMBR column. I need to do a bulk update to TABLE1.PULLDATE per a project number, but that project number is stored in TABLE2.PROJECT.
Using VisualStudio 2005 and in VB code not C+, does anyone know the code (if there is any) that links the tables and allows me to update all TABLE1.PULLDATE records grouped by TABLE2.PROJECT? I will be providing the trigger to update using a textbox [TxtBox_Pulldate] and a nearby button [Button_UpdatePulldate].
Thanks a bunch
Chuck Vensel
I think I understand that you want to update Table1 given a matching column in Table2?
You write the SQL update just as you would the SELECT except replace the SELECT clause with the UPDATE clause.
UPDATE Table1
SET
[PULLDATE] = your_value
FROM
Table1
JOIN Table2
ON Table2.[JOBNMBR] = Table1.[JOBNMBR]
WHERE
Table2.[PROJECT] = your_project_ID

Resources