-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck-h1b-table-schema.sql
More file actions
50 lines (45 loc) · 1.49 KB
/
Copy pathcheck-h1b-table-schema.sql
File metadata and controls
50 lines (45 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- Check the existing h1b_applications table schema
-- Run this first to understand the current table structure
-- Step 1: Check if h1b_applications table exists
SELECT 'Checking if h1b_applications table exists' as step;
SELECT EXISTS (
SELECT FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name = 'h1b_applications'
) as table_exists;
-- Step 2: Get table schema
SELECT 'Getting h1b_applications table schema' as step;
SELECT
column_name,
data_type,
is_nullable,
column_default,
character_maximum_length
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = 'h1b_applications'
ORDER BY ordinal_position;
-- Step 3: Check sample data
SELECT 'Sample data from h1b_applications' as step;
SELECT * FROM h1b_applications LIMIT 5;
-- Step 4: Check data counts and basic stats
SELECT 'Basic statistics from h1b_applications' as step;
SELECT
COUNT(*) as total_records,
COUNT(DISTINCT employer_name) as unique_employers,
COUNT(DISTINCT case_status) as unique_statuses,
MIN(wage_rate_of_pay_from) as min_salary,
MAX(wage_rate_of_pay_from) as max_salary,
AVG(wage_rate_of_pay_from) as avg_salary
FROM h1b_applications
WHERE wage_rate_of_pay_from IS NOT NULL AND wage_rate_of_pay_from > 0;
-- Step 5: Check existing indexes
SELECT 'Existing indexes on h1b_applications' as step;
SELECT
schemaname,
tablename,
indexname,
indexdef
FROM pg_indexes
WHERE tablename = 'h1b_applications'
ORDER BY indexname;