Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Running select from V$ views from remote server Linux/Unix
  • Optimizer SORT Operations Oracle
  • ORA-3136 Oracle
  • arch_configUOCIOTTO.ora Oracle
  • Directory wise folder wise space usage Linux/Unix
  • Day to day MYSQL DBA operations (Compared with Oracle DBA) MYSQL
  • longtx.sql Oracle
  • Unix split command to split files Linux/Unix
  • find_pdbs.sql Uncategorized
  • Small sample shell program Linux/Unix
  • get_vmstat_solaris Oracle
  • Gather Stats manually using DBMS_STATS after disabling DBMS_SCHEDULER jobs as previous entry Oracle
  • CTAS with LONG Column for 7.x and 8 and 8i Oracle
  • How to calculate PROCESSES parameter Oracle
  • Generating XML from SQLPLUS Oracle

Getting started with notebook

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Getting started with notebook
# Databricks notebook source

 

%sql
create database if not exists abcdb

 

%sql
use abcdb

 

%sql
create table student (id int , name string)

 

%sql
insert into student
select 1 as id, ‘user1’ as name

 

%sql
select * from student

 

spark.sql(“create database if not exists xyzdb”)
spark.sql(“use xyzdb”)

 

# Use three double quotes (“””) if SQL you are using has multiple lines.
spark.sql(“”” create table student1
        ( id int,
        name string )”””)

 

spark.sql(“”” insert into student1
        select 2 as id, ‘test1’ as name””” )

 

# Different format of printing or displaying dataframe.

# Selecting rows from dataframe
spark.sql(“select * from student1”).display()
spark.sql(“select * from student1”).show()

# Storing result-set in collection
spark.sql(“select * from student1”).collect

# Describe schema and datatype
spark.sql(“select * from student1”).printSchema()

 
Python/PySpark

Post navigation

Previous Post: Read CSV file using PySpark
Next Post: Add new columns in dataframe

Related Posts

  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Add new columns in dataframe Python/PySpark
  • Read CSV File using Python Python/PySpark
  • Reading config file from other folder inside class Python/PySpark
  • Python class import from different folders Python/PySpark
  • Read CSV file using PySpark Python/PySpark

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (150)
  • MYSQL (5)
  • Oracle (403)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (151)
  • SQL scripts (349)
  • SQL Server (6)
  • Uncategorized (5)
  • Videos (0)

Recent Posts

  • Key Management in Oracle: The Core Issue: Missing Master Key12-May-2026
  • SAT Mathematics 10 questions and answer at the end.30-Apr-2026
  • top 10 AI news today30-Apr-2026
  • runon_allpdbs_show_conname.sh23-Apr-2026
  • runon_allcdbs_find_pdbs.sh23-Apr-2026
  • Running PDB on single node in RAC09-Apr-2026
  • find_arc.sql09-Apr-2026
  • pvm_pre_change.sql08-Apr-2026
  • find_encr_wallet.sql08-Apr-2026
  • find_pdbs.sql08-Apr-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • SQL Server: How to see current transactions or requests SQL Server
  • Goldengate document from Porus Oracle
  • configUOCIOTTO.ora Oracle
  • The most important Tuning Notes Oracle
  • Changing the Global Database Name Oracle
  • longtx.sql with the flag whether session is blocking any DML locks or not. Oracle
  • shutdown linux Linux/Unix
  • sid_wise_cursor.sql find open cursor basis on username or SID Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme