Find an $f\in L^1([0,1])\setminus L^2([0,1])$ such that $\int_E|f(x)|\,dx\leq\sqrt{|E|}$ for all Borel $E\subset [0,1]$. 
Suppose $f\in L^1([0,1])$ has the property that
$$\int_E|f(x)|\,dx\leq\sqrt{|E|},\tag{$*$}$$
for every Borel $E \subseteq[0,1]$. Here $|E|$ denotes the Lebesgue measure of $E$.

*

*Show that $f \in L^{p}([0,1])$ for all $1<p<2$.

*Give an example of an $f$ satisfying $(*)$ that is not it $L^{2}([0,1])$.


I can prove $f \in L^{p}([0,1])$ for all $1<p<2$. For each $\lambda>0$, we define $E_\lambda=\{x\in[0,1]: |f(x)|\geq\lambda\}$ and $d_f(\lambda)=|E_\lambda|$. By $(*)$ we have
$$\lambda d_f(\lambda)\leq \int_{E_\lambda}|f(x)|\,dx\leq\sqrt{d_f(\lambda)},$$
hence $$d_f(\lambda)\leq \begin{cases} 1 & \text{if }\lambda\leq1,\\ \lambda^{-2} & \text{if }\lambda>1. \end{cases}$$
Therefore,
$$\int_0^1 |f(x)|^p\,dx=p\int_0^\infty \lambda^{p-1}d_f(\lambda)\,d\lambda\leq 1+p\int_1^\infty \lambda^{p-3}\,d\lambda<\infty$$
for $p\in(1,2)$.
However, I can't find an example an $f$ satisfying $(*)$ that is not it $L^{2}([0,1])$. I guess $f(x)=\frac12x^{-1/2}$ will do the job, but I don't know how to check $(*)$ for this $f$.
Any help would be appreciated!

Indeed, the function $f(x)=x^{-1/2}/2$ works well. Given a measurable set $E \subset  [0,1]$, the goal is to prove
$$\int_E|f(x)|\,dx\leq\sqrt{|E|},\tag{$*$}$$
Given $\epsilon>0$, there exists a countable union of disjoint intervals $V=\cup_{j \ge 1} I_j \supset E$ (with $I_j$ ordered in decreasing length) such that $|V| <|E|+\epsilon$. So it suffices to prove the inequality $(*)$ for $V$ in place of $E$. Let $V_n=\cup_{j = 1}^n I_j$ be the union of the $n$ longest intervals among the $I_j$. If we prove $(*)$ for $V_n$ in place of $E$, then it will follow for $V$ by monotone convergence. But shifting an interval to the left increases the integral of $f$ over this interval, since $f$ is decreasing. Thus the integral is maximized when the intervals are all adjacent and the leftmost endpoint is 0; in that case the inequality is clear.
