Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • For Perl DBI installation and testing program PHP/MYSQL/Wordpress
  • Physical Standby switchover with session active Oracle
  • Some OS level threshold for performance. Linux/Unix
  • Committing distributed transaction using commit force Oracle
  • Read CSV file using PySpark Python/PySpark
  • find_pdbs.sql Uncategorized
  • CPU Core related projections AWS
  • Check Oracle installed products using one command Oracle
  • Search and replace pattern Linux/Unix
  • Deleting first line and lastline of a file using sed Linux/Unix
  • telnet listening Linux/Unix
  • ORA-00064: object is too large to allocate on this O/S during startup Oracle
  • Important Script Method for tuning Oracle
  • proper cpu stats Linux/Unix
  • How to Modify the statistics collection by MMON for AWR repository 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

  • Read CSV File using Python Python/PySpark
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Python class import from different folders Python/PySpark
  • Read CSV file using PySpark Python/PySpark
  • Reading config file from other folder inside class Python/PySpark
  • Add new columns in dataframe 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
  • get_vmstat_solaris Oracle
  • catall.sh Linux/Unix
  • Gather Stats manually using DBMS_STATS after disabling DBMS_SCHEDULER jobs as previous entry Oracle
  • How to sort list of files on basis of their sizes. Linux/Unix
  • Ports used by Oracle Software Oracle
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • VIvek Encryption Package and Its Usage Oracle
  • How do I get Oracle to automatically start when my server boots up? Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme